home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue27 / construc / WININET.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-09-29  |  80.0 KB  |  1,684 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Run-time Library                         }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996,97 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit WinInet;
  12.  
  13. {$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Windows;
  18.  
  19. { Contains manifests, functions, types and prototypes for 
  20.   Microsoft Windows Internet Extensions }
  21.  
  22.  
  23. { internet types }
  24.  
  25. type
  26.   HINTERNET = Pointer; 
  27.   PHINTERNET = ^HINTERNET; 
  28.  
  29.   INTERNET_PORT = Word; 
  30.   PINTERNET_PORT = ^INTERNET_PORT; 
  31.  
  32.  
  33. { Internet APIs }
  34.  
  35.  
  36. { manifests }
  37.  
  38.  
  39. const
  40.   INTERNET_INVALID_PORT_NUMBER = 0;                 { use the protocol-specific default }
  41.  
  42.   INTERNET_DEFAULT_FTP_PORT = 21;                   { default for FTP servers }
  43.   INTERNET_DEFAULT_GOPHER_PORT = 70;                {    "     "  gopher " }
  44.   INTERNET_DEFAULT_HTTP_PORT = 80;                  {    "     "  HTTP   " }
  45.   INTERNET_DEFAULT_HTTPS_PORT = 443;                {    "     "  HTTPS  " }
  46.   MAX_CACHE_ENTRY_INFO_SIZE = 4096; 
  47.  
  48.  
  49. { maximum field lengths (arbitrary) }
  50.  
  51.   INTERNET_MAX_HOST_NAME_LENGTH = 256; 
  52.   INTERNET_MAX_USER_NAME_LENGTH = 128; 
  53.   INTERNET_MAX_PASSWORD_LENGTH = 128; 
  54.   INTERNET_MAX_PORT_NUMBER_LENGTH = 5;              { INTERNET_PORT is unsigned short }
  55.   INTERNET_MAX_PORT_NUMBER_VALUE = 65535;           { maximum unsigned short value }
  56.   INTERNET_MAX_PATH_LENGTH = 1024; 
  57.   INTERNET_MAX_PROTOCOL_NAME = 'gopher';            { longest protocol name }
  58.   INTERNET_MAX_URL_LENGTH = ((SizeOf(INTERNET_MAX_PROTOCOL_NAME) - 1) 
  59.                             + SizeOf('://')
  60.                             + INTERNET_MAX_PATH_LENGTH);
  61.  
  62.  
  63. { values returned by InternetQueryOption with INTERNET_OPTION_KEEP_CONNECTION: }
  64.  
  65.   INTERNET_KEEP_ALIVE_UNKNOWN = -1; 
  66.   INTERNET_KEEP_ALIVE_ENABLED = 1; 
  67.   INTERNET_KEEP_ALIVE_DISABLED = 0; 
  68.  
  69. { flags returned by InternetQueryOption with INTERNET_OPTION_REQUEST_FLAGS }
  70.  
  71.   INTERNET_REQFLAG_FROM_CACHE = $00000001; 
  72.   INTERNET_REQFLAG_ASYNC = $00000002; 
  73.  
  74. { flags common to open functions (not InternetOpen): }
  75.  
  76.   INTERNET_FLAG_RELOAD = $80000000;                 { retrieve the original item }
  77.  
  78. { flags for InternetOpenUrl: }
  79.  
  80.   INTERNET_FLAG_RAW_DATA = $40000000;               { receive the item as raw data }
  81.   INTERNET_FLAG_EXISTING_CONNECT = $20000000;       { do not create new connection object }
  82.  
  83. { flags for InternetOpen: }
  84.  
  85.   INTERNET_FLAG_ASYNC = $10000000;                  { this request is asynchronous (where supported) }
  86.  
  87. { protocol-specific flags: }
  88.  
  89.   INTERNET_FLAG_PASSIVE = $08000000;                { used for FTP connections }
  90.  
  91. { additional cache flags }
  92.  
  93.   INTERNET_FLAG_NO_CACHE_WRITE        = $04000000;  { don't write this item to the cache }
  94.   INTERNET_FLAG_DONT_CACHE            = INTERNET_FLAG_NO_CACHE_WRITE; 
  95.   INTERNET_FLAG_MAKE_PERSISTENT       = $02000000;  { make this item persistent in cache }
  96.   INTERNET_FLAG_OFFLINE               = $01000000;  { use offline semantics }
  97.  
  98. { additional flags }
  99.  
  100.   INTERNET_FLAG_SECURE                = $00800000;  { use PCT/SSL if applicable (HTTP) }
  101.   INTERNET_FLAG_KEEP_CONNECTION       = $00400000;  { use keep-alive semantics }
  102.   INTERNET_FLAG_NO_AUTO_REDIRECT      = $00200000;  { don't handle redirections automatically }
  103.   INTERNET_FLAG_READ_PREFETCH         = $00100000;  { do background read prefetch }
  104.  
  105. { Security Ignore Flags, Allow HttpOpenRequest to overide
  106.   Secure Channel (SSL/PCT) failures of the following types. }
  107.  
  108.   INTERNET_FLAG_IGNORE_CERT_CN_INVALID        = $00001000; { bad common name in X509 Cert. }
  109.   INTERNET_FLAG_IGNORE_CERT_DATE_INVALID      = $00002000; { expired X509 Cert. }
  110.   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS      = $00004000; { ex: http:// to https:// }
  111.   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP       = $00008000; { ex: https:// to http:// }
  112.  
  113. { FTP }
  114.  
  115. { manifests }
  116. const
  117.   FTP_TRANSFER_TYPE_UNKNOWN = $00000000; 
  118.   FTP_TRANSFER_TYPE_ASCII = $00000001; 
  119.   FTP_TRANSFER_TYPE_BINARY = $00000002; 
  120.  
  121.   FTP_TRANSFER_TYPE_MASK = $00000003; 
  122.  
  123. { flags for FTP }
  124.  
  125.   INTERNET_FLAG_TRANSFER_ASCII        = FTP_TRANSFER_TYPE_ASCII; 
  126.   INTERNET_FLAG_TRANSFER_BINARY       = FTP_TRANSFER_TYPE_BINARY; 
  127.  
  128. { flags field masks }
  129.  
  130.   SECURITY_INTERNET_MASK      = INTERNET_FLAG_IGNORE_CERT_CN_INVALID or
  131.                                 INTERNET_FLAG_IGNORE_CERT_DATE_INVALID or 
  132.                                 INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS or 
  133.                                 INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
  134.  
  135.   SECURITY_SET_MASK           = SECURITY_INTERNET_MASK; 
  136.  
  137.   INTERNET_FLAGS_MASK         = INTERNET_FLAG_RELOAD               or
  138.                                 INTERNET_FLAG_RAW_DATA             or 
  139.                                 INTERNET_FLAG_EXISTING_CONNECT     or 
  140.                                 INTERNET_FLAG_ASYNC                or 
  141.                                 INTERNET_FLAG_PASSIVE              or 
  142.                                 INTERNET_FLAG_DONT_CACHE           or 
  143.                                 INTERNET_FLAG_MAKE_PERSISTENT      or 
  144.                                 INTERNET_FLAG_OFFLINE              or 
  145.                                 INTERNET_FLAG_SECURE               or 
  146.                                 INTERNET_FLAG_KEEP_CONNECTION      or 
  147.                                 INTERNET_FLAG_NO_AUTO_REDIRECT     or 
  148.                                 INTERNET_FLAG_READ_PREFETCH        or 
  149.                                 SECURITY_INTERNET_MASK             or 
  150.                                 INTERNET_FLAG_TRANSFER_ASCII       or 
  151.                                 INTERNET_FLAG_TRANSFER_BINARY;
  152.  
  153.   INTERNET_OPTIONS_MASK       =  not INTERNET_FLAGS_MASK; 
  154.  
  155.  
  156. { INTERNET_NO_CALLBACK - if this value is presented as the dwContext parameter }
  157. { then no call-backs will be made for that API }
  158.  
  159.   INTERNET_NO_CALLBACK = 0; 
  160.  
  161. { structures/types }
  162.  
  163. type
  164.   PInternetScheme = ^TInternetScheme;
  165.   TInternetScheme = Integer; 
  166. const
  167.   INTERNET_SCHEME_PARTIAL = -2; 
  168.   INTERNET_SCHEME_UNKNOWN = -1; 
  169.   INTERNET_SCHEME_DEFAULT = 0; 
  170.   INTERNET_SCHEME_FTP = 1; 
  171.   INTERNET_SCHEME_GOPHER = 2; 
  172.   INTERNET_SCHEME_HTTP = 3; 
  173.   INTERNET_SCHEME_HTTPS = 4; 
  174.   INTERNET_SCHEME_FILE = 5; 
  175.   INTERNET_SCHEME_NEWS = 6; 
  176.   INTERNET_SCHEME_MAILTO = 7; 
  177.   INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP; 
  178.   INTERNET_SCHEME_LAST = INTERNET_SCHEME_MAILTO; 
  179.  
  180. { TInternetAsyncResult - this structure is returned to the application via }
  181. { the callback with INTERNET_STATUS_REQUEST_COMPLETE. It is not sufficient to }
  182. { just return the result of the async operation. If the API failed then the }
  183. { app cannot call GetLastError because the thread context will be incorrect. }
  184. { Both the value returned by the async API and any resultant error code are }
  185. { made available. The app need not check dwError if dwResult indicates that }
  186. { the API succeeded (in this case dwError will be ERROR_SUCCESS) }
  187.  
  188. type
  189.   PInternetAsyncResult = ^TInternetAsyncResult;
  190.   TInternetAsyncResult = packed record
  191.     dwResult: DWORD; { the HINTERNET, DWORD or BOOL return code from an async API }
  192.     dwError: DWORD; { dwError - the error code if the API failed }
  193.   end;
  194.  
  195.   PInternetPrefetchStatus = ^TInternetPrefetchStatus;
  196.   TInternetPrefetchStatus = packed record
  197.     dwStatus: DWORD;  { dwStatus - status of download. See INTERNET_PREFETCH_ flags }
  198.     dwSize: DWORD;    { dwSize - size of file downloaded so far }
  199.   end;
  200.  
  201.  
  202. const
  203. { INTERNET_PREFETCH_STATUS - dwStatus values }
  204.   INTERNET_PREFETCH_PROGRESS      = 0; 
  205.   INTERNET_PREFETCH_COMPLETE      = 1; 
  206.   INTERNET_PREFETCH_ABORTED       = 2; 
  207.  
  208.  
  209.  
  210. type
  211. { TInternetProxyInfo - structure supplied with INTERNET_OPTION_PROXY to get/ }
  212. { set proxy information on a InternetOpen handle }
  213.   PInternetProxyInfo = ^TInternetProxyInfo;
  214.   TInternetProxyInfo = packed record
  215.     dwAccessType: DWORD;       { dwAccessType - INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PROXY, or }
  216.     lpszProxy: LPCSTR;        { lpszProxy - proxy server list }
  217.     lpszProxyBypass: LPCSTR;  { lpszProxyBypass - proxy bypass list }
  218.   end;
  219.  
  220.  
  221. { URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl }
  222. { and InternetCreateUrl }
  223.  
  224. { For InternetCrackUrl, if a pointer field and its corresponding length field }
  225. { are both 0 then that component is not returned; If the pointer field is NULL }
  226. { but the length field is not zero, then both the pointer and length fields are }
  227. { returned; if both pointer and corresponding length fields are non-zero then }
  228. { the pointer field points to a buffer where the component is copied. The }
  229. { component may be un-escaped, depending on dwFlags }
  230.  
  231. { For InternetCreateUrl, the pointer fields should be nil if the component }
  232. { is not required. If the corresponding length field is zero then the pointer }
  233. { field is the address of a zero-terminated string. If the length field is not }
  234. { zero then it is the string length of the corresponding pointer field }
  235.  
  236.  
  237.   PURLComponents = ^TURLComponents;
  238.   TURLComponents = packed record 
  239.     dwStructSize: DWORD;        { size of this structure. Used in version check }
  240.     lpszScheme: LPSTR;         { pointer to scheme name }
  241.     dwSchemeLength: DWORD;      { length of scheme name }
  242.     nScheme: TInternetScheme;    { enumerated scheme type (if known) }
  243.     lpszHostName: LPSTR;       { pointer to host name }
  244.     dwHostNameLength: DWORD;    { length of host name }
  245.     nPort: INTERNET_PORT;       { converted port number }
  246.     lpszUserName: LPSTR;       { pointer to user name }
  247.     dwUserNameLength: DWORD;    { length of user name }
  248.     lpszPassword: LPSTR;       { pointer to password }
  249.     dwPasswordLength: DWORD;    { length of password }
  250.     lpszUrlPath: LPSTR;        { pointer to URL-path }
  251.     dwUrlPathLength: DWORD;     { length of URL-path }
  252.     lpszExtraInfo: LPSTR;      { pointer to extra information (e.g. ?foo or #foo) }
  253.     dwExtraInfoLength: DWORD;   { length of extra information }
  254.   end;
  255.  
  256.  
  257. { TInternetCertificateInfo lpBuffer - contains the certificate returned from
  258.   the server }
  259.   
  260.   PInternetCertificateInfo = ^TInternetCertificateInfo;
  261.   TInternetCertificateInfo = packed record
  262.     ftExpiry: TFileTime;             { ftExpiry - date the certificate expires. }
  263.     ftStart: TFileTime;              { ftStart - date the certificate becomes valid. }
  264.     lpszSubjectInfo: LPSTR;        { lpszSubjectInfo - the name of organization, site, and server }
  265.                                     {   the cert. was issued for. }
  266.     lpszIssuerInfo: LPSTR;         { lpszIssuerInfo - the name of orgainzation, site, and server }
  267.                                     {   the cert was issues by. }
  268.     lpszProtocolName: LPSTR;       { lpszProtocolName - the name of the protocol used to provide the secure }
  269.                                     {   connection. }
  270.     lpszSignatureAlgName: LPSTR;   { lpszSignatureAlgName - the name of the algorithm used for signing }
  271.                                     {  the certificate. }
  272.     lpszEncryptionAlgName: LPSTR;  { lpszEncryptionAlgName - the name of the algorithm used for }
  273.                                     {  doing encryption over the secure channel (SSL/PCT) connection. }
  274.     dwKeySize: DWORD;               { dwKeySize - size of the key. }
  275.   end;
  276.  
  277.   
  278. { prototypes }
  279.  
  280. function InternetTimeFromSystemTime(const pst: TSystemTime; 
  281.   dwRFC: DWORD; lpszTime: LPSTR; cbTime: DWORD): BOOL; stdcall;
  282.  
  283. const
  284. { constants for InternetTimeFromSystemTime }
  285.   INTERNET_RFC1123_FORMAT         = 0; 
  286.   INTERNET_RFC1123_BUFSIZE        = 30; 
  287.  
  288. function InternetCrackUrlA(lpszUrl: PAnsiChar; dwUrlLength, dwFlags: DWORD;
  289.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  290. function InternetCrackUrlW(lpszUrl: PWideChar; dwUrlLength, dwFlags: DWORD;
  291.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  292. function InternetCrackUrl(lpszUrl: PChar; dwUrlLength, dwFlags: DWORD;
  293.   var lpUrlComponents: TURLComponents): BOOL; stdcall;
  294.  
  295. function InternetCreateUrlA(var lpUrlComponents: TURLComponents;
  296.   dwFlags: DWORD; lpszUrl: PAnsiChar; var dwUrlLength: DWORD): BOOL; stdcall;
  297. function InternetCreateUrlW(var lpUrlComponents: TURLComponents;
  298.   dwFlags: DWORD; lpszUrl: PWideChar; var dwUrlLength: DWORD): BOOL; stdcall;
  299. function InternetCreateUrl(var lpUrlComponents: TURLComponents;
  300.   dwFlags: DWORD; lpszUrl: PChar; var dwUrlLength: DWORD): BOOL; stdcall;
  301.  
  302. function InternetCanonicalizeUrlA(lpszUrl: PAnsiChar;
  303.   lpszBuffer: PAnsiChar; var lpdwBufferLength: DWORD;
  304.   dwFlags: DWORD): BOOL; stdcall;
  305. function InternetCanonicalizeUrlW(lpszUrl: PWideChar;
  306.   lpszBuffer: PWideChar; var lpdwBufferLength: DWORD;
  307.   dwFlags: DWORD): BOOL; stdcall;
  308. function InternetCanonicalizeUrl(lpszUrl: PChar;
  309.   lpszBuffer: PChar; var lpdwBufferLength: DWORD;
  310.   dwFlags: DWORD): BOOL; stdcall;
  311.  
  312. function InternetCombineUrlA(lpszBaseUrl, lpszRelativeUrl: PAnsiChar;
  313.   lpszBuffer: PAnsiChar; var lpdwBufferLength: DWORD;
  314.   dwFlags: DWORD): BOOL; stdcall;
  315. function InternetCombineUrlW(lpszBaseUrl, lpszRelativeUrl: PWideChar;
  316.   lpszBuffer: PWideChar; var lpdwBufferLength: DWORD;
  317.   dwFlags: DWORD): BOOL; stdcall;
  318. function InternetCombineUrl(lpszBaseUrl, lpszRelativeUrl: PChar;
  319.   lpszBuffer: PChar; var lpdwBufferLength: DWORD;
  320.   dwFlags: DWORD): BOOL; stdcall;
  321.  
  322. const
  323. { flags for InternetCrackUrl and InternetCreateUrl }
  324.  
  325.   ICU_ESCAPE          = $80000000;  { (un)escape URL characters }
  326.   ICU_USERNAME        = $40000000;  { use internal username & password }
  327.  
  328.  
  329. { flags for InternetCanonicalizeUrl and InternetCombineUrl }
  330.  
  331.   ICU_NO_ENCODE       = $20000000;  { Don't convert unsafe characters to escape sequence }
  332.   ICU_DECODE          = $10000000;  { Convert escape sequences to characters }
  333.   ICU_NO_META         = $08000000;  { Don't convert .. etc. meta path sequences }
  334.   ICU_ENCODE_SPACES_ONLY     = $04000000;  { Encode spaces only }
  335.  
  336. function InternetOpenA(lpszAgent: PAnsiChar; dwAccessType: DWORD; 
  337.   lpszProxy, lpszProxyBypass: PAnsiChar; dwFlags: DWORD): HINTERNET; stdcall;
  338. function InternetOpenW(lpszAgent: PWideChar; dwAccessType: DWORD; 
  339.   lpszProxy, lpszProxyBypass: PWideChar; dwFlags: DWORD): HINTERNET; stdcall;
  340. function InternetOpen(lpszAgent: PChar; dwAccessType: DWORD; 
  341.   lpszProxy, lpszProxyBypass: PChar; dwFlags: DWORD): HINTERNET; stdcall;
  342.  
  343. { access types for InternetOpen }
  344. const
  345.   INTERNET_OPEN_TYPE_PRECONFIG        = 0;  { use registry configuration }
  346.   INTERNET_OPEN_TYPE_DIRECT           = 1;  { direct to net }
  347.   INTERNET_OPEN_TYPE_PROXY            = 3;  { via named proxy }
  348.  
  349.   PRE_CONFIG_INTERNET_ACCESS      = INTERNET_OPEN_TYPE_PRECONFIG; 
  350.   LOCAL_INTERNET_ACCESS           = INTERNET_OPEN_TYPE_DIRECT; 
  351.   GATEWAY_INTERNET_ACCESS         = 2;  { Internet via gateway }
  352.   CERN_PROXY_INTERNET_ACCESS      = INTERNET_OPEN_TYPE_PROXY; 
  353.  
  354.  
  355. function InternetCloseHandle(hInet: HINTERNET): BOOL; stdcall;
  356.  
  357. function InternetConnectA(hInet: HINTERNET; lpszServerName: PAnsiChar; 
  358.   nServerPort: INTERNET_PORT; lpszUsername: PAnsiChar; lpszPassword: PAnsiChar; 
  359.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  360. function InternetConnectW(hInet: HINTERNET; lpszServerName: PWideChar; 
  361.   nServerPort: INTERNET_PORT; lpszUsername: PWideChar; lpszPassword: PWideChar; 
  362.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  363. function InternetConnect(hInet: HINTERNET; lpszServerName: PChar; 
  364.   nServerPort: INTERNET_PORT; lpszUsername: PChar; lpszPassword: PChar; 
  365.   dwService: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  366.  
  367.  
  368. { service types for InternetConnect }
  369. const
  370.   INTERNET_SERVICE_FTP = 1; 
  371.   INTERNET_SERVICE_GOPHER = 2; 
  372.   INTERNET_SERVICE_HTTP = 3; 
  373.  
  374.  
  375. function InternetOpenUrlA(hInet: HINTERNET; lpszUrl: PAnsiChar; 
  376.   lpszHeaders: PAnsiChar; dwHeadersLength: DWORD; dwFlags: DWORD; 
  377.   dwContext: DWORD): HINTERNET; stdcall;
  378. function InternetOpenUrlW(hInet: HINTERNET; lpszUrl: PWideChar; 
  379.   lpszHeaders: PWideChar; dwHeadersLength: DWORD; dwFlags: DWORD; 
  380.   dwContext: DWORD): HINTERNET; stdcall;
  381. function InternetOpenUrl(hInet: HINTERNET; lpszUrl: PChar; 
  382.   lpszHeaders: PChar; dwHeadersLength: DWORD; dwFlags: DWORD; 
  383.   dwContext: DWORD): HINTERNET; stdcall;
  384.  
  385. function InternetReadFile(hFile: HINTERNET; lpBuffer: Pointer; 
  386.   dwNumberOfBytesToRead: DWORD; var lpdwNumberOfBytesRead: DWORD): BOOL; stdcall;
  387.  
  388. function InternetSetFilePointer(hFile: HINTERNET;
  389.   lDistanceToMove: Longint; pReserved: Pointer;
  390.   dwMoveMethod, dwContext: DWORD): DWORD; stdcall;
  391.  
  392. function InternetWriteFile(hFile: HINTERNET; lpBuffer: Pointer; 
  393.   dwNumberOfBytesToWrite: DWORD; 
  394.   var lpdwNumberOfBytesWritten: DWORD): BOOL; stdcall;
  395.  
  396. function InternetQueryDataAvailable(hFile: HINTERNET; var lpdwNumberOfBytesAvailable: DWORD; 
  397.   dwFlags, dwContext: DWORD): BOOL; stdcall;
  398.  
  399. function InternetFindNextFileA(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  400. function InternetFindNextFileW(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  401. function InternetFindNextFile(hFind: HINTERNET; lpvFindData: Pointer): BOOL; stdcall;
  402.  
  403. function InternetQueryOptionA(hInet: HINTERNET; dwOption: DWORD; 
  404.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  405. function InternetQueryOptionW(hInet: HINTERNET; dwOption: DWORD; 
  406.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  407. function InternetQueryOption(hInet: HINTERNET; dwOption: DWORD; 
  408.   lpBuffer: Pointer; var lpdwBufferLength: DWORD): BOOL; stdcall;
  409.  
  410. function InternetSetOptionA(hInet: HINTERNET; dwOption: DWORD; 
  411.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  412. function InternetSetOptionW(hInet: HINTERNET; dwOption: DWORD; 
  413.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  414. function InternetSetOption(hInet: HINTERNET; dwOption: DWORD; 
  415.   lpBuffer: Pointer; dwBufferLength: DWORD): BOOL; stdcall;
  416.  
  417. function InternetSetOptionExA(hInet: HINTERNET; dwOption: DWORD; 
  418.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  419. function InternetSetOptionExW(hInet: HINTERNET; dwOption: DWORD; 
  420.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  421. function InternetSetOptionEx(hInet: HINTERNET; dwOption: DWORD; 
  422.   lpBuffer: Pointer; dwBufferLength, dwFlags: DWORD): BOOL; stdcall;
  423.  
  424.  
  425. { options manifests for Internet(Query or Set)Option }
  426. const
  427.   INTERNET_OPTION_CALLBACK = 1; 
  428.   INTERNET_OPTION_CONNECT_TIMEOUT = 2; 
  429.   INTERNET_OPTION_CONNECT_RETRIES = 3; 
  430.   INTERNET_OPTION_CONNECT_BACKOFF = 4; 
  431.   INTERNET_OPTION_SEND_TIMEOUT = 5; 
  432.   INTERNET_OPTION_CONTROL_SEND_TIMEOUT       = INTERNET_OPTION_SEND_TIMEOUT; 
  433.   INTERNET_OPTION_RECEIVE_TIMEOUT = 6; 
  434.   INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT    = INTERNET_OPTION_RECEIVE_TIMEOUT; 
  435.   INTERNET_OPTION_DATA_SEND_TIMEOUT = 7; 
  436.   INTERNET_OPTION_DATA_RECEIVE_TIMEOUT = 8; 
  437.   INTERNET_OPTION_HANDLE_TYPE = 9; 
  438.   INTERNET_OPTION_CONTEXT_VALUE = 10; 
  439.  
  440.   INTERNET_OPTION_READ_BUFFER_SIZE = 12; 
  441.   INTERNET_OPTION_WRITE_BUFFER_SIZE = 13; 
  442.   
  443.   INTERNET_OPTION_ASYNC_ID = 15; 
  444.   INTERNET_OPTION_ASYNC_PRIORITY = 16; 
  445.   
  446.   INTERNET_OPTION_PARENT_HANDLE               = 21; 
  447.   INTERNET_OPTION_KEEP_CONNECTION             = 22; 
  448.   INTERNET_OPTION_REQUEST_FLAGS               = 23; 
  449.   INTERNET_OPTION_EXTENDED_ERROR              = 24; 
  450.  
  451.   INTERNET_OPTION_OFFLINE_MODE                = 26; 
  452.   INTERNET_OPTION_CACHE_STREAM_HANDLE         = 27; 
  453.   INTERNET_OPTION_USERNAME                    = 28; 
  454.   INTERNET_OPTION_PASSWORD                    = 29; 
  455.   INTERNET_OPTION_ASYNC                       = 30; 
  456.   INTERNET_OPTION_SECURITY_FLAGS              = 31; 
  457.   INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT        = 32; 
  458.   INTERNET_OPTION_DATAFILE_NAME               = 33; 
  459.   INTERNET_OPTION_URL                         = 34; 
  460.   INTERNET_OPTION_SECURITY_CERTIFICATE        = 35; 
  461.   INTERNET_OPTION_SECURITY_KEY_BITNESS        = 36; 
  462.   INTERNET_OPTION_REFRESH                     = 37; 
  463.   INTERNET_OPTION_PROXY                       = 38; 
  464.  
  465.   INTERNET_FIRST_OPTION                      = INTERNET_OPTION_CALLBACK; 
  466.   INTERNET_LAST_OPTION                       = INTERNET_OPTION_PROXY; 
  467.  
  468. { values for INTERNET_OPTION_PRIORITY }
  469.  
  470.   INTERNET_PRIORITY_FOREGROUND = 1000; 
  471.  
  472. { handle types }
  473.  
  474.   INTERNET_HANDLE_TYPE_INTERNET = 1; 
  475.   INTERNET_HANDLE_TYPE_CONNECT_FTP = 2; 
  476.   INTERNET_HANDLE_TYPE_CONNECT_GOPHER = 3; 
  477.   INTERNET_HANDLE_TYPE_CONNECT_HTTP = 4; 
  478.   INTERNET_HANDLE_TYPE_FTP_FIND = 5; 
  479.   INTERNET_HANDLE_TYPE_FTP_FIND_HTML = 6; 
  480.   INTERNET_HANDLE_TYPE_FTP_FILE = 7; 
  481.   INTERNET_HANDLE_TYPE_FTP_FILE_HTML = 8; 
  482.   INTERNET_HANDLE_TYPE_GOPHER_FIND = 9; 
  483.   INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML = 10; 
  484.   INTERNET_HANDLE_TYPE_GOPHER_FILE = 11; 
  485.   INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML = 12; 
  486.   INTERNET_HANDLE_TYPE_HTTP_REQUEST = 13; 
  487.  
  488. { values for INTERNET_OPTION_SECURITY_FLAGS }
  489.  
  490.   SECURITY_FLAG_SECURE                        = $00000001; { can query only }
  491.   SECURITY_FLAG_SSL                           = $00000002; 
  492.   SECURITY_FLAG_SSL3                          = $00000004; 
  493.   SECURITY_FLAG_PCT                           = $00000008; 
  494.   SECURITY_FLAG_PCT4                          = $00000010; 
  495.   SECURITY_FLAG_IETFSSL4                      = $00000020; 
  496.  
  497.   SECURITY_FLAG_40BIT                         = $10000000; 
  498.   SECURITY_FLAG_128BIT                        = $20000000; 
  499.   SECURITY_FLAG_56BIT                         = $40000000; 
  500.   SECURITY_FLAG_UNKNOWNBIT                    = $80000000; 
  501.   SECURITY_FLAG_NORMALBITNESS                 = SECURITY_FLAG_40BIT; 
  502.  
  503.   SECURITY_FLAG_IGNORE_CERT_CN_INVALID        = INTERNET_FLAG_IGNORE_CERT_CN_INVALID; 
  504.   SECURITY_FLAG_IGNORE_CERT_DATE_INVALID      = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID; 
  505.   SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS      = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS; 
  506.   SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP       = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; 
  507.  
  508. function InternetGetLastResponseInfoA(var lpdwError: DWORD; lpszBuffer: PAnsiChar; 
  509.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  510. function InternetGetLastResponseInfoW(var lpdwError: DWORD; lpszBuffer: PWideChar; 
  511.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  512. function InternetGetLastResponseInfo(var lpdwError: DWORD; lpszBuffer: PChar; 
  513.   var lpdwBufferLength: DWORD): BOOL; stdcall;
  514.  
  515. { callback function for InternetSetStatusCallback }
  516. type
  517.   TFNInternetStatusCallback = TFarProc;
  518.   PFNInternetStatusCallback = ^TFNInternetStatusCallback;
  519.  
  520.  
  521. function InternetSetStatusCallback(hInet: HINTERNET; 
  522.   lpfnInternetCallback: PFNInternetStatusCallback): PFNInternetStatusCallback; stdcall;
  523.  
  524.  
  525. { status manifests for Internet status callback }
  526. const
  527.   INTERNET_STATUS_RESOLVING_NAME              = 10; 
  528.   INTERNET_STATUS_NAME_RESOLVED               = 11; 
  529.   INTERNET_STATUS_CONNECTING_TO_SERVER        = 20; 
  530.   INTERNET_STATUS_CONNECTED_TO_SERVER         = 21; 
  531.   INTERNET_STATUS_SENDING_REQUEST             = 30; 
  532.   INTERNET_STATUS_REQUEST_SENT                = 31; 
  533.   INTERNET_STATUS_RECEIVING_RESPONSE          = 40; 
  534.   INTERNET_STATUS_RESPONSE_RECEIVED           = 41; 
  535.   INTERNET_STATUS_CTL_RESPONSE_RECEIVED       = 42; 
  536.   INTERNET_STATUS_PREFETCH                    = 43; 
  537.   INTERNET_STATUS_CLOSING_CONNECTION          = 50; 
  538.   INTERNET_STATUS_CONNECTION_CLOSED           = 51; 
  539.   INTERNET_STATUS_HANDLE_CREATED              = 60; 
  540.   INTERNET_STATUS_HANDLE_CLOSING              = 70; 
  541.   INTERNET_STATUS_REQUEST_COMPLETE            = 100; 
  542.   INTERNET_STATUS_REDIRECT                    = 110; 
  543.  
  544. { if the following value is returned by InternetSetStatusCallback, then }
  545. { probably an invalid (non-code) address was supplied for the callback }
  546.  
  547.   INTERNET_INVALID_STATUS_CALLBACK = (-1); 
  548.  
  549.  
  550. { prototypes }
  551.  
  552. function FtpFindFirstFileA(hConnect: HINTERNET; lpszSearchFile: PAnsiChar; 
  553.   var lpFindFileData: TWin32FindDataA; dwFlags: DWORD; 
  554.   dwContext: DWORD): HINTERNET; stdcall;
  555. function FtpFindFirstFileW(hConnect: HINTERNET; lpszSearchFile: PWideChar; 
  556.   var lpFindFileData: TWin32FindDataW; dwFlags: DWORD; 
  557.   dwContext: DWORD): HINTERNET; stdcall;
  558. function FtpFindFirstFile(hConnect: HINTERNET; lpszSearchFile: PChar; 
  559.   var lpFindFileData: TWin32FindData; dwFlags: DWORD; 
  560.   dwContext: DWORD): HINTERNET; stdcall;
  561.  
  562. function FtpGetFileA(hConnect: HINTERNET; lpszRemoteFile: PAnsiChar; 
  563.   lpszNewFile: PAnsiChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD; 
  564.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  565. function FtpGetFileW(hConnect: HINTERNET; lpszRemoteFile: PWideChar; 
  566.   lpszNewFile: PWideChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD; 
  567.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  568. function FtpGetFile(hConnect: HINTERNET; lpszRemoteFile: PChar; 
  569.   lpszNewFile: PChar; fFailIfExists: BOOL; dwFlagsAndAttributes: DWORD; 
  570.   dwFlags: DWORD; dwContext: DWORD): BOOL stdcall;
  571.  
  572. function FtpPutFileA(hConnect: HINTERNET; lpszLocalFile: PAnsiChar; 
  573.   lpszNewRemoteFile: PAnsiChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  574. function FtpPutFileW(hConnect: HINTERNET; lpszLocalFile: PWideChar; 
  575.   lpszNewRemoteFile: PWideChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  576. function FtpPutFile(hConnect: HINTERNET; lpszLocalFile: PChar; 
  577.   lpszNewRemoteFile: PChar; dwFlags: DWORD; dwContext: DWORD): BOOL; stdcall;
  578.  
  579. function FtpDeleteFileA(hConnect: HINTERNET; lpszFileName: PAnsiChar): BOOL; stdcall;
  580. function FtpDeleteFileW(hConnect: HINTERNET; lpszFileName: PWideChar): BOOL; stdcall;
  581. function FtpDeleteFile(hConnect: HINTERNET; lpszFileName: PChar): BOOL; stdcall;
  582.  
  583. function FtpRenameFileA(hConnect: HINTERNET; lpszExisting: PAnsiChar; 
  584.   lpszNew: PAnsiChar): BOOL; stdcall;
  585. function FtpRenameFileW(hConnect: HINTERNET; lpszExisting: PWideChar; 
  586.   lpszNew: PWideChar): BOOL; stdcall;
  587. function FtpRenameFile(hConnect: HINTERNET; lpszExisting: PChar; 
  588.   lpszNew: PChar): BOOL; stdcall;
  589.  
  590. function FtpOpenFileA(hConnect: HINTERNET; lpszFileName: PAnsiChar; 
  591.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  592. function FtpOpenFileW(hConnect: HINTERNET; lpszFileName: PWideChar; 
  593.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  594. function FtpOpenFile(hConnect: HINTERNET; lpszFileName: PChar; 
  595.   dwAccess: DWORD; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  596.  
  597. function FtpCreateDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  598. function FtpCreateDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  599. function FtpCreateDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  600.  
  601. function FtpRemoveDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  602. function FtpRemoveDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  603. function FtpRemoveDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  604.  
  605. function FtpSetCurrentDirectoryA(hConnect: HINTERNET; lpszDirectory: PAnsiChar): BOOL; stdcall;
  606. function FtpSetCurrentDirectoryW(hConnect: HINTERNET; lpszDirectory: PWideChar): BOOL; stdcall;
  607. function FtpSetCurrentDirectory(hConnect: HINTERNET; lpszDirectory: PChar): BOOL; stdcall;
  608.  
  609. function FtpGetCurrentDirectoryA(hConnect: HINTERNET; 
  610.   lpszCurrentDirectory: PAnsiChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  611. function FtpGetCurrentDirectoryW(hConnect: HINTERNET; 
  612.   lpszCurrentDirectory: PWideChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  613. function FtpGetCurrentDirectory(hConnect: HINTERNET; 
  614.   lpszCurrentDirectory: PChar; var lpdwCurrentDirectory: DWORD): BOOL; stdcall;
  615.  
  616. function FtpCommandA(hConnect: HINTERNET; fExpectResponse: BOOL; 
  617.   dwFlags: DWORD; lpszCommand: PAnsiChar; dwContext: DWORD): BOOL; stdcall;
  618. function FtpCommandW(hConnect: HINTERNET; fExpectResponse: BOOL; 
  619.   dwFlags: DWORD; lpszCommand: PWideChar; dwContext: DWORD): BOOL; stdcall;
  620. function FtpCommand(hConnect: HINTERNET; fExpectResponse: BOOL; 
  621.   dwFlags: DWORD; lpszCommand: PChar; dwContext: DWORD): BOOL; stdcall;
  622.  
  623.  
  624. { Gopher }
  625.  
  626. { manifests }
  627.  
  628. { string field lengths (in characters, not bytes) }
  629. const
  630.   MAX_GOPHER_DISPLAY_TEXT   = 128; 
  631.   MAX_GOPHER_SELECTOR_TEXT  = 256; 
  632.   MAX_GOPHER_HOST_NAME      = INTERNET_MAX_HOST_NAME_LENGTH; 
  633.   MAX_GOPHER_LOCATOR_LENGTH = 1                                  
  634.                               + MAX_GOPHER_DISPLAY_TEXT           
  635.                               + 1                                 
  636.                               + MAX_GOPHER_SELECTOR_TEXT          
  637.                               + 1                                 
  638.                               + MAX_GOPHER_HOST_NAME              
  639.                               + 1                                 
  640.                               + INTERNET_MAX_PORT_NUMBER_LENGTH   
  641.                               + 1                                 
  642.                               + 1                                 
  643.                               + 2; 
  644.  
  645.  
  646. { structures/types }
  647.  
  648. { GOPHER_FIND_DATA - returns the results of a GopherFindFirstFile/ }
  649. { InternetFindNextFile request }
  650.  
  651.  
  652. type
  653.   PGopherFindDataA = ^TGopherFindDataA;
  654.   PGopherFindDataW = ^TGopherFindDataW;
  655.   PGopherFindData = PGopherFindDataA;
  656.   TGopherFindDataA = packed record
  657.     DisplayString: packed array[0..MAX_GOPHER_DISPLAY_TEXT-1] of AnsiChar;
  658.     GopherType: DWORD;  { GopherType - if known }
  659.     SizeLow: DWORD;
  660.     SizeHigh: DWORD;
  661.     LastModificationTime: TFileTime;
  662.     Locator: packed array[0..MAX_GOPHER_LOCATOR_LENGTH-1] of AnsiChar;
  663.   end;
  664.   TGopherFindDataW = packed record
  665.     DisplayString: packed array[0..MAX_GOPHER_DISPLAY_TEXT-1] of WideChar;
  666.     GopherType: DWORD;  { GopherType - if known }
  667.     SizeLow: DWORD;
  668.     SizeHigh: DWORD;
  669.     LastModificationTime: TFileTime;
  670.     Locator: packed array[0..MAX_GOPHER_LOCATOR_LENGTH-1] of WideChar;
  671.   end;
  672.   TGopherFindData = TGopherFindDataA;
  673.  
  674.  
  675. { manifests for GopherType }
  676. const
  677.   GOPHER_TYPE_TEXT_FILE = $00000001; 
  678.   GOPHER_TYPE_DIRECTORY = $00000002; 
  679.   GOPHER_TYPE_CSO = $00000004; 
  680.   GOPHER_TYPE_ERROR = $00000008; 
  681.   GOPHER_TYPE_MAC_BINHEX = $00000010; 
  682.   GOPHER_TYPE_DOS_ARCHIVE = $00000020; 
  683.   GOPHER_TYPE_UNIX_UUENCODED = $00000040; 
  684.   GOPHER_TYPE_INDEX_SERVER = $00000080; 
  685.   GOPHER_TYPE_TELNET = $00000100; 
  686.   GOPHER_TYPE_BINARY = $00000200; 
  687.   GOPHER_TYPE_REDUNDANT = $00000400; 
  688.   GOPHER_TYPE_TN3270 = $00000800; 
  689.   GOPHER_TYPE_GIF = $00001000; 
  690.   GOPHER_TYPE_IMAGE = $00002000; 
  691.   GOPHER_TYPE_BITMAP = $00004000; 
  692.   GOPHER_TYPE_MOVIE = $00008000; 
  693.   GOPHER_TYPE_SOUND = $00010000; 
  694.   GOPHER_TYPE_HTML = $00020000; 
  695.   GOPHER_TYPE_PDF = $00040000; 
  696.   GOPHER_TYPE_CALENDAR = $00080000; 
  697.   GOPHER_TYPE_INLINE = $00100000; 
  698.   GOPHER_TYPE_UNKNOWN = $20000000; 
  699.   GOPHER_TYPE_ASK = $40000000; 
  700.   GOPHER_TYPE_GOPHER_PLUS = $80000000; 
  701.  
  702.  
  703. { Gopher Type functions }
  704.  
  705. function IS_GOPHER_FILE(GopherType: DWORD): BOOL;
  706. function IS_GOPHER_DIRECTORY(GopherType: DWORD): BOOL;
  707. function IS_GOPHER_PHONE_SERVER(GopherType: DWORD): BOOL;
  708. function IS_GOPHER_ERROR(GopherType: DWORD): BOOL;
  709. function IS_GOPHER_INDEX_SERVER(GopherType: DWORD): BOOL;
  710. function IS_GOPHER_TELNET_SESSION(GopherType: DWORD): BOOL;
  711. function IS_GOPHER_BACKUP_SERVER(GopherType: DWORD): BOOL;
  712. function IS_GOPHER_TN3270_SESSION(GopherType: DWORD): BOOL;
  713. function IS_GOPHER_ASK(GopherType: DWORD): BOOL;
  714. function IS_GOPHER_PLUS(GopherType: DWORD): BOOL;
  715. function IS_GOPHER_TYPE_KNOWN(GopherType: DWORD): BOOL;
  716.  
  717.  
  718. { GOPHER_TYPE_FILE_MASK - use this to determine if a locator identifies a }
  719. { (known) file type }
  720. const
  721.   GOPHER_TYPE_FILE_MASK = GOPHER_TYPE_TEXT_FILE          
  722.                           or GOPHER_TYPE_MAC_BINHEX        
  723.                           or GOPHER_TYPE_DOS_ARCHIVE       
  724.                           or GOPHER_TYPE_UNIX_UUENCODED    
  725.                           or GOPHER_TYPE_BINARY            
  726.                           or GOPHER_TYPE_GIF               
  727.                           or GOPHER_TYPE_IMAGE             
  728.                           or GOPHER_TYPE_BITMAP            
  729.                           or GOPHER_TYPE_MOVIE             
  730.                           or GOPHER_TYPE_SOUND             
  731.                           or GOPHER_TYPE_HTML              
  732.                           or GOPHER_TYPE_PDF               
  733.                           or GOPHER_TYPE_CALENDAR          
  734.                           or GOPHER_TYPE_INLINE; 
  735.  
  736.  
  737. { structured gopher attributes (as defined in gopher+ protocol document) }
  738. type
  739.   PGopherAdminAttributeType = ^TGopherAdminAttributeType;
  740.   TGopherAdminAttributeType = packed record 
  741.     Comment: LPCSTR;
  742.     EmailAddress: LPCSTR;
  743.   end;
  744.  
  745.   PGopherModDateAttributeType = ^TGopherModDateAttributeType;
  746.   TGopherModDateAttributeType = packed record 
  747.     DateAndTime: TFileTime;
  748.   end;
  749.  
  750.   PGopherTtlAttributeType = ^TGopherTtlAttributeType;
  751.   TGopherTtlAttributeType = packed record 
  752.     Ttl: DWORD;
  753.   end;
  754.  
  755.   PGopherScoreAttributeType = ^TGopherScoreAttributeType;
  756.   TGopherScoreAttributeType = packed record 
  757.     Score: Integer;
  758.   end;
  759.  
  760.   PGopherScoreRangeAttributeType = ^TGopherScoreRangeAttributeType;
  761.   TGopherScoreRangeAttributeType = packed record 
  762.     LowerBound: Integer;
  763.     UpperBound: Integer;
  764.   end;
  765.  
  766.   PGopherSiteAttributeType = ^TGopherSiteAttributeType;
  767.   TGopherSiteAttributeType = packed record 
  768.     Site: LPCSTR;
  769.   end;
  770.  
  771.   PGopherOrganizationAttributeType = ^TGopherOrganizationAttributeType;
  772.   TGopherOrganizationAttributeType = packed record 
  773.     Organization: LPCSTR;
  774.   end;
  775.  
  776.   PGopherLocationAttributeType = ^TGopherLocationAttributeType;
  777.   TGopherLocationAttributeType = packed record 
  778.     Location: LPCSTR;
  779.   end;
  780.  
  781.   PGopherGeographicalLocationAttributeType = ^TGopherGeographicalLocationAttributeType;
  782.   TGopherGeographicalLocationAttributeType = packed record 
  783.     DegreesNorth: Integer;
  784.     MinutesNorth: Integer;
  785.     SecondsNorth: Integer;
  786.     DegreesEast: Integer;
  787.     MinutesEast: Integer;
  788.     SecondsEast: Integer;
  789.   end;
  790.  
  791.   PGopherTimezoneAttributeType = ^TGopherTimezoneAttributeType;
  792.   TGopherTimezoneAttributeType = packed record 
  793.     Zone: Integer;
  794.   end;
  795.  
  796.   PGopherProviderAttributeType = ^TGopherProviderAttributeType;
  797.   TGopherProviderAttributeType = packed record 
  798.     Provider: LPCSTR;
  799.   end;
  800.  
  801.   PGopherVersionAttributeType = ^TGopherVersionAttributeType;
  802.   TGopherVersionAttributeType = packed record 
  803.     Version: LPCSTR;
  804.   end;
  805.  
  806.   PGopherAbstractAttributeType = ^TGopherAbstractAttributeType;
  807.   TGopherAbstractAttributeType = packed record 
  808.     ShortAbstract: LPCSTR;
  809.     AbstractFile: LPCSTR;
  810.   end;
  811.  
  812.   PGopherViewAttributeType = ^TGopherViewAttributeType;
  813.   TGopherViewAttributeType = packed record 
  814.     ContentType: LPCSTR;
  815.     Language: LPCSTR;
  816.     Size: DWORD;
  817.   end;
  818.  
  819.   PGopherVeronicaAttributeType = ^TGopherVeronicaAttributeType;
  820.   TGopherVeronicaAttributeType = packed record 
  821.     TreeWalk: BOOL;
  822.   end;
  823.  
  824.   PGopherAskAttributeType = ^TGopherAskAttributeType;
  825.   TGopherAskAttributeType = packed record 
  826.     QuestionType: LPCSTR;
  827.     QuestionText: LPCSTR;
  828.   end;
  829.  
  830.  
  831. { GOPHER_UNKNOWN_ATTRIBUTE_TYPE - this is returned if we retrieve an attribute }
  832. { that is not specified in the current gopher/gopher+ documentation. It is up }
  833. { to the application to parse the information }
  834.  
  835.   PGopherUnknownAttributeType = ^TGopherUnknownAttributeType;
  836.   TGopherUnknownAttributeType = packed record 
  837.     Text: LPCSTR;
  838.   end;
  839.  
  840.  
  841. { GOPHER_ATTRIBUTE_TYPE - returned in the user's buffer when an enumerated }
  842. { GopherGetAttribute call is made }
  843.  
  844.   PGopherAttributeType = ^TGopherAttributeType;
  845.   TGopherAttributeType = packed record 
  846.     CategoryId: DWORD;  { e.g. GOPHER_CATEGORY_ID_ADMIN }
  847.     AttributeId: DWORD; { e.g. GOPHER_ATTRIBUTE_ID_ADMIN }
  848.     case Integer of
  849.       0: (Admin: TGopherAdminAttributeType);
  850.       1: (ModDate: TGopherModDateAttributeType);
  851.       2: (Ttl: TGopherTtlAttributeType);
  852.       3: (Score: TGopherScoreAttributeType);
  853.       4: (ScoreRange: TGopherScoreRangeAttributeType);
  854.       5: (Site: TGopherSiteAttributeType);
  855.       6: (Organization: TGopherOrganizationAttributeType);
  856.       7: (Location: TGopherLocationAttributeType);
  857.       8: (GeographicalLocation: TGopherGeographicalLocationAttributeType);
  858.       9: (TimeZone: TGopherTimezoneAttributeType);
  859.       10: (Provider: TGopherProviderAttributeType);
  860.       11: (Version: TGopherVersionAttributeType);
  861.       12: (AbstractType: TGopherAbstractAttributeType);
  862.       13: (View: TGopherViewAttributeType);
  863.       14: (Veronica: TGopherVeronicaAttributeType);
  864.       15: (Ask: TGopherAskAttributeType);
  865.       16: (Unknown: TGopherUnknownAttributeType);
  866.     end;
  867.  
  868. const
  869.   MAX_GOPHER_CATEGORY_NAME = 128;           { arbitrary }
  870.   MAX_GOPHER_ATTRIBUTE_NAME = 128;          {     " }
  871.   MIN_GOPHER_ATTRIBUTE_LENGTH = 256;        {     " }
  872.  
  873.  
  874. { known gopher attribute categories. See below for ordinals }
  875.  
  876.   GOPHER_INFO_CATEGORY           = '+INFO'; 
  877.   GOPHER_ADMIN_CATEGORY          = '+ADMIN'; 
  878.   GOPHER_VIEWS_CATEGORY          = '+VIEWS'; 
  879.   GOPHER_ABSTRACT_CATEGORY       = '+ABSTRACT'; 
  880.   GOPHER_VERONICA_CATEGORY       = '+VERONICA'; 
  881.  
  882.  
  883. { known gopher attributes. These are the attribute names as defined in the }
  884. { gopher+ protocol document }
  885.  
  886.   GOPHER_ADMIN_ATTRIBUTE         = 'Admin'; 
  887.   GOPHER_MOD_DATE_ATTRIBUTE      = 'Mod-Date'; 
  888.   GOPHER_TTL_ATTRIBUTE           = 'TTL'; 
  889.   GOPHER_SCORE_ATTRIBUTE         = 'Score'; 
  890.   GOPHER_RANGE_ATTRIBUTE         = 'Score-range'; 
  891.   GOPHER_SITE_ATTRIBUTE          = 'Site'; 
  892.   GOPHER_ORG_ATTRIBUTE           = 'Org'; 
  893.   GOPHER_LOCATION_ATTRIBUTE      = 'Loc'; 
  894.   GOPHER_GEOG_ATTRIBUTE          = 'Geog'; 
  895.   GOPHER_TIMEZONE_ATTRIBUTE      = 'TZ'; 
  896.   GOPHER_PROVIDER_ATTRIBUTE      = 'Provider'; 
  897.   GOPHER_VERSION_ATTRIBUTE       = 'Version'; 
  898.   GOPHER_ABSTRACT_ATTRIBUTE      = 'Abstract'; 
  899.   GOPHER_VIEW_ATTRIBUTE          = 'View'; 
  900.   GOPHER_TREEWALK_ATTRIBUTE      = 'treewalk'; 
  901.  
  902.  
  903. { identifiers for attribute strings }
  904.  
  905.   GOPHER_ATTRIBUTE_ID_BASE = $abcccc00; 
  906.   GOPHER_CATEGORY_ID_ALL = GOPHER_ATTRIBUTE_ID_BASE + 1; 
  907.   GOPHER_CATEGORY_ID_INFO = GOPHER_ATTRIBUTE_ID_BASE + 2; 
  908.   GOPHER_CATEGORY_ID_ADMIN = GOPHER_ATTRIBUTE_ID_BASE + 3; 
  909.   GOPHER_CATEGORY_ID_VIEWS = GOPHER_ATTRIBUTE_ID_BASE + 4; 
  910.   GOPHER_CATEGORY_ID_ABSTRACT = GOPHER_ATTRIBUTE_ID_BASE + 5; 
  911.   GOPHER_CATEGORY_ID_VERONICA = GOPHER_ATTRIBUTE_ID_BASE + 6; 
  912.   GOPHER_CATEGORY_ID_ASK = GOPHER_ATTRIBUTE_ID_BASE + 7; 
  913.   GOPHER_CATEGORY_ID_UNKNOWN = GOPHER_ATTRIBUTE_ID_BASE + 8; 
  914.   GOPHER_ATTRIBUTE_ID_ALL = GOPHER_ATTRIBUTE_ID_BASE + 9; 
  915.   GOPHER_ATTRIBUTE_ID_ADMIN = GOPHER_ATTRIBUTE_ID_BASE + 10; 
  916.   GOPHER_ATTRIBUTE_ID_MOD_DATE = GOPHER_ATTRIBUTE_ID_BASE + 11; 
  917.   GOPHER_ATTRIBUTE_ID_TTL = GOPHER_ATTRIBUTE_ID_BASE + 12; 
  918.   GOPHER_ATTRIBUTE_ID_SCORE = GOPHER_ATTRIBUTE_ID_BASE + 13; 
  919.   GOPHER_ATTRIBUTE_ID_RANGE = GOPHER_ATTRIBUTE_ID_BASE + 14; 
  920.   GOPHER_ATTRIBUTE_ID_SITE = GOPHER_ATTRIBUTE_ID_BASE + 15; 
  921.   GOPHER_ATTRIBUTE_ID_ORG = GOPHER_ATTRIBUTE_ID_BASE + 16; 
  922.   GOPHER_ATTRIBUTE_ID_LOCATION = GOPHER_ATTRIBUTE_ID_BASE + 17; 
  923.   GOPHER_ATTRIBUTE_ID_GEOG = GOPHER_ATTRIBUTE_ID_BASE + 18; 
  924.   GOPHER_ATTRIBUTE_ID_TIMEZONE = GOPHER_ATTRIBUTE_ID_BASE + 19; 
  925.   GOPHER_ATTRIBUTE_ID_PROVIDER = GOPHER_ATTRIBUTE_ID_BASE + 20; 
  926.   GOPHER_ATTRIBUTE_ID_VERSION = GOPHER_ATTRIBUTE_ID_BASE + 21; 
  927.   GOPHER_ATTRIBUTE_ID_ABSTRACT = GOPHER_ATTRIBUTE_ID_BASE + 22; 
  928.   GOPHER_ATTRIBUTE_ID_VIEW = GOPHER_ATTRIBUTE_ID_BASE + 23; 
  929.   GOPHER_ATTRIBUTE_ID_TREEWALK = GOPHER_ATTRIBUTE_ID_BASE + 24; 
  930.   GOPHER_ATTRIBUTE_ID_UNKNOWN = GOPHER_ATTRIBUTE_ID_BASE + 25; 
  931.  
  932.  
  933. { prototypes }
  934.  
  935. function GopherCreateLocatorA(lpszHost: PAnsiChar; nServerPort: INTERNET_PORT; 
  936.   lpszDisplayString: PAnsiChar; lpszSelectorString: PAnsiChar; dwGopherType: DWORD; 
  937.   lpszLocator: PAnsiChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  938. function GopherCreateLocatorW(lpszHost: PWideChar; nServerPort: INTERNET_PORT; 
  939.   lpszDisplayString: PWideChar; lpszSelectorString: PWideChar; dwGopherType: DWORD; 
  940.   lpszLocator: PWideChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  941. function GopherCreateLocator(lpszHost: PChar; nServerPort: INTERNET_PORT; 
  942.   lpszDisplayString: PChar; lpszSelectorString: PChar; dwGopherType: DWORD; 
  943.   lpszLocator: PChar; var lpdwBufferLength: DWORD): BOOL; stdcall;
  944.  
  945. function GopherGetLocatorTypeA(lpszLocator: PAnsiChar; 
  946.   var lpdwGopherType: DWORD): BOOL; stdcall;
  947. function GopherGetLocatorTypeW(lpszLocator: PWideChar; 
  948.   var lpdwGopherType: DWORD): BOOL; stdcall;
  949. function GopherGetLocatorType(lpszLocator: PChar; 
  950.   var lpdwGopherType: DWORD): BOOL; stdcall;
  951.  
  952. function GopherFindFirstFileA(hConnect: HINTERNET; lpszLocator: PAnsiChar; 
  953.   lpszSearchString: PAnsiChar; var lpFindData: TGopherFindDataA; dwFlags: DWORD; 
  954.   dwContext: DWORD): HINTERNET; stdcall;
  955. function GopherFindFirstFileW(hConnect: HINTERNET; lpszLocator: PWideChar; 
  956.   lpszSearchString: PWideChar; var lpFindData: TGopherFindDataW; dwFlags: DWORD; 
  957.   dwContext: DWORD): HINTERNET; stdcall;
  958. function GopherFindFirstFile(hConnect: HINTERNET; lpszLocator: PChar; 
  959.   lpszSearchString: PChar; var lpFindData: TGopherFindData; dwFlags: DWORD; 
  960.   dwContext: DWORD): HINTERNET; stdcall;
  961.  
  962. function GopherOpenFileA(hConnect: HINTERNET; lpszLocator: PAnsiChar; 
  963.   lpszView: PAnsiChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  964. function GopherOpenFileW(hConnect: HINTERNET; lpszLocator: PWideChar; 
  965.   lpszView: PWideChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  966. function GopherOpenFile(hConnect: HINTERNET; lpszLocator: PChar; 
  967.   lpszView: PChar; dwFlags: DWORD; dwContext: DWORD): HINTERNET; stdcall;
  968.  
  969. type
  970.   TFNGopherAttributeEnumerator = TFarProc;
  971.   PFNGopherAttributeEnumerator = ^TFNGopherAttributeEnumerator;
  972.  
  973. function GopherGetAttributeA(hConnect: HINTERNET; lpszLocator: PAnsiChar; 
  974.   lpszAttributeName: PAnsiChar; lpBuffer: Pointer; dwBufferLength: DWORD; 
  975.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  976.   dwContext: DWORD): BOOL; stdcall;
  977. function GopherGetAttributeW(hConnect: HINTERNET; lpszLocator: PWideChar; 
  978.   lpszAttributeName: PWideChar; lpBuffer: Pointer; dwBufferLength: DWORD; 
  979.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  980.   dwContext: DWORD): BOOL; stdcall;
  981. function GopherGetAttribute(hConnect: HINTERNET; lpszLocator: PChar; 
  982.   lpszAttributeName: PChar; lpBuffer: Pointer; dwBufferLength: DWORD; 
  983.   var lpdwCharactersReturned: DWORD; lpfnEnumerator: PFNGopherAttributeEnumerator;
  984.   dwContext: DWORD): BOOL; stdcall;
  985.  
  986. { HTTP }
  987.  
  988. { manifests }
  989.  
  990. const
  991. { the default major/minor HTTP version numbers }
  992.  
  993.   HTTP_MAJOR_VERSION = 1; 
  994.   HTTP_MINOR_VERSION = 0; 
  995.   HTTP_VERSION       = 'HTTP/1'; 
  996.  
  997.  
  998. { HttpQueryInfo info levels. Generally, there is one info level }
  999. { for each potential RFC822/HTTP/MIME header that an HTTP server }
  1000. { may send as part of a request response. }
  1001.  
  1002. { The HTTP_QUERY_RAW_HEADERS info level is provided for clients }
  1003. { that choose to perform their own header parsing. }
  1004.  
  1005.   HTTP_QUERY_MIME_VERSION                     = 0; 
  1006.   HTTP_QUERY_CONTENT_TYPE                     = 1; 
  1007.   HTTP_QUERY_CONTENT_TRANSFER_ENCODING        = 2; 
  1008.   HTTP_QUERY_CONTENT_ID                       = 3; 
  1009.   HTTP_QUERY_CONTENT_DESCRIPTION              = 4; 
  1010.   HTTP_QUERY_CONTENT_LENGTH                   = 5; 
  1011.   HTTP_QUERY_CONTENT_LANGUAGE                 = 6; 
  1012.   HTTP_QUERY_ALLOW                            = 7; 
  1013.   HTTP_QUERY_PUBLIC                           = 8; 
  1014.   HTTP_QUERY_DATE                             = 9; 
  1015.   HTTP_QUERY_EXPIRES                          = 10; 
  1016.   HTTP_QUERY_LAST_MODIFIED                    = 11; 
  1017.   HTTP_QUERY_MESSAGE_ID                       = 12; 
  1018.   HTTP_QUERY_URI                              = 13; 
  1019.   HTTP_QUERY_DERIVED_FROM                     = 14; 
  1020.   HTTP_QUERY_COST                             = 15; 
  1021.   HTTP_QUERY_LINK                             = 16; 
  1022.   HTTP_QUERY_PRAGMA                           = 17; 
  1023.   HTTP_QUERY_VERSION                          = 18; { special: part of status line }
  1024.   HTTP_QUERY_STATUS_CODE                      = 19; { special: part of status line }
  1025.   HTTP_QUERY_STATUS_TEXT                      = 20; { special: part of status line }
  1026.   HTTP_QUERY_RAW_HEADERS                      = 21; { special: all headers as ASCIIZ }
  1027.   HTTP_QUERY_RAW_HEADERS_CRLF                 = 22; { special: all headers }
  1028.   HTTP_QUERY_CONNECTION                       = 23; 
  1029.   HTTP_QUERY_ACCEPT                           = 24; 
  1030.   HTTP_QUERY_ACCEPT_CHARSET                   = 25; 
  1031.   HTTP_QUERY_ACCEPT_ENCODING                  = 26; 
  1032.   HTTP_QUERY_ACCEPT_LANGUAGE                  = 27; 
  1033.   HTTP_QUERY_AUTHORIZATION                    = 28; 
  1034.   HTTP_QUERY_CONTENT_ENCODING                 = 29; 
  1035.   HTTP_QUERY_FORWARDED                        = 30; 
  1036.   HTTP_QUERY_FROM                             = 31; 
  1037.   HTTP_QUERY_IF_MODIFIED_SINCE                = 32; 
  1038.   HTTP_QUERY_LOCATION                         = 33; 
  1039.   HTTP_QUERY_ORIG_URI                         = 34; 
  1040.   HTTP_QUERY_REFERER                          = 35; 
  1041.   HTTP_QUERY_RETRY_AFTER                      = 36; 
  1042.   HTTP_QUERY_SERVER                           = 37; 
  1043.   HTTP_QUERY_TITLE                            = 38; 
  1044.   HTTP_QUERY_USER_AGENT                       = 39; 
  1045.   HTTP_QUERY_WWW_AUTHENTICATE                 = 40; 
  1046.   HTTP_QUERY_PROXY_AUTHENTICATE               = 41; 
  1047.   HTTP_QUERY_ACCEPT_RANGES                    = 42; 
  1048.   HTTP_QUERY_SET_COOKIE                       = 43; 
  1049.   HTTP_QUERY_COOKIE                           = 44; 
  1050.   
  1051.   HTTP_QUERY_MAX                              = 44; 
  1052.  
  1053.  
  1054. { HTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel }
  1055. { parameter of HttpQueryInfo then the lpBuffer parameter contains the name }
  1056. { of the header we are to query }
  1057.   HTTP_QUERY_CUSTOM                           = 65535; 
  1058.  
  1059. { HTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel }
  1060. { parameter of HttpQueryInfo then the request headers will be queried for the }
  1061. { request information }
  1062.   HTTP_QUERY_FLAG_REQUEST_HEADERS             = $80000000; 
  1063.  
  1064. { HTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter }
  1065. { of HttpQueryInfo AND the header being queried contains date information, }
  1066. { e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure }
  1067. { containing the date and time information converted from the header string }
  1068.   HTTP_QUERY_FLAG_SYSTEMTIME                  = $40000000; 
  1069.  
  1070. { HTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of }
  1071. { HttpQueryInfo, then the value of the header will be converted to a number }
  1072. { before being returned to the caller, if applicable }
  1073.   HTTP_QUERY_FLAG_NUMBER                      = $20000000; 
  1074.  
  1075. { HTTP_QUERY_FLAG_COALESCE - combine the values from several headers of the }
  1076. { same name into the output buffer }
  1077.   HTTP_QUERY_FLAG_COALESCE                    = $10000000; 
  1078.  
  1079.   HTTP_QUERY_MODIFIER_FLAGS_MASK              = HTTP_QUERY_FLAG_REQUEST_HEADERS or
  1080.                                                 HTTP_QUERY_FLAG_SYSTEMTIME or
  1081.                                                 HTTP_QUERY_FLAG_NUMBER or
  1082.                                                 HTTP_QUERY_FLAG_COALESCE; 
  1083.  
  1084.   HTTP_QUERY_HEADER_MASK                      = not HTTP_QUERY_MODIFIER_FLAGS_MASK; 
  1085.  
  1086.   
  1087. {  HTTP Response Status Codes: }
  1088.  
  1089.   HTTP_STATUS_OK                  = 200;    { request completed }
  1090.   HTTP_STATUS_CREATED             = 201;    { object created, reason = new URI }
  1091.   HTTP_STATUS_ACCEPTED            = 202;    { async completion (TBS) }
  1092.   HTTP_STATUS_PARTIAL             = 203;    { partial completion }
  1093.   HTTP_STATUS_NO_CONTENT          = 204;    { no info to return }
  1094.  
  1095.   HTTP_STATUS_AMBIGUOUS           = 300;    { server couldn't decide what to return }
  1096.   HTTP_STATUS_MOVED               = 301;    { object permanently moved }
  1097.   HTTP_STATUS_REDIRECT            = 302;    { object temporarily moved }
  1098.   HTTP_STATUS_REDIRECT_METHOD     = 303;    { redirection w/ new access method }
  1099.   HTTP_STATUS_NOT_MODIFIED        = 304;    { if-modified-since was not modified }
  1100.  
  1101.   HTTP_STATUS_BAD_REQUEST         = 400;    { invalid syntax }
  1102.   HTTP_STATUS_DENIED              = 401;    { access denied }
  1103.   HTTP_STATUS_PAYMENT_REQ         = 402;    { payment required }
  1104.   HTTP_STATUS_FORBIDDEN           = 403;    { request forbidden }
  1105.   HTTP_STATUS_NOT_FOUND           = 404;    { object not found }
  1106.   HTTP_STATUS_BAD_METHOD          = 405;    { method is not allowed }
  1107.   HTTP_STATUS_NONE_ACCEPTABLE     = 406;    { no response acceptable to client found }
  1108.   HTTP_STATUS_PROXY_AUTH_REQ      = 407;    { proxy authentication required }
  1109.   HTTP_STATUS_REQUEST_TIMEOUT     = 408;    { server timed out waiting for request }
  1110.   HTTP_STATUS_CONFLICT            = 409;    { user should resubmit with more info }
  1111.   HTTP_STATUS_GONE                = 410;    { the resource is no longer available }
  1112.   HTTP_STATUS_AUTH_REFUSED        = 411;    { couldn't authorize client }
  1113.  
  1114.   HTTP_STATUS_SERVER_ERROR        = 500;    { internal server error }
  1115.   HTTP_STATUS_NOT_SUPPORTED       = 501;    { required not supported }
  1116.   HTTP_STATUS_BAD_GATEWAY         = 502;    { error response received from gateway }
  1117.   HTTP_STATUS_SERVICE_UNAVAIL     = 503;    { temporarily overloaded }
  1118.   HTTP_STATUS_GATEWAY_TIMEOUT     = 504;    { timed out waiting for gateway }
  1119.  
  1120.  
  1121. { prototypes }
  1122.  
  1123. function HttpOpenRequestA(hConnect: HINTERNET; lpszVerb: PAnsiChar; 
  1124.   lpszObjectName: PAnsiChar; lpszVersion: PAnsiChar; lpszReferrer: PAnsiChar; 
  1125.   lplpszAcceptTypes: PAnsiChar; dwFlags: DWORD; 
  1126.   dwContext: DWORD): HINTERNET; stdcall;
  1127. function HttpOpenRequestW(hConnect: HINTERNET; lpszVerb: PWideChar; 
  1128.   lpszObjectName: PWideChar; lpszVersion: PWideChar; lpszReferrer: PWideChar; 
  1129.   lplpszAcceptTypes: PWideChar; dwFlags: DWORD; 
  1130.   dwContext: DWORD): HINTERNET; stdcall;
  1131. function HttpOpenRequest(hConnect: HINTERNET; lpszVerb: PChar; 
  1132.   lpszObjectName: PChar; lpszVersion: PChar; lpszReferrer: PChar; 
  1133.   lplpszAcceptTypes: PChar; dwFlags: DWORD; 
  1134.   dwContext: DWORD): HINTERNET; stdcall;
  1135.  
  1136. function HttpAddRequestHeadersA(hRequest: HINTERNET; lpszHeaders: PAnsiChar; 
  1137.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1138. function HttpAddRequestHeadersW(hRequest: HINTERNET; lpszHeaders: PWideChar; 
  1139.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1140. function HttpAddRequestHeaders(hRequest: HINTERNET; lpszHeaders: PChar; 
  1141.   dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
  1142.  
  1143. const
  1144. { values for dwModifiers parameter of HttpAddRequestHeaders }
  1145.  
  1146.   HTTP_ADDREQ_INDEX_MASK          = $0000FFFF; 
  1147.   HTTP_ADDREQ_FLAGS_MASK          = $FFFF0000; 
  1148.  
  1149. { HTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't }
  1150. { already exist }
  1151.  
  1152.   HTTP_ADDREQ_FLAG_ADD_IF_NEW     = $10000000; 
  1153.  
  1154. { HTTP_ADDREQ_FLAG_ADD - if HTTP_ADDREQ_FLAG_REPLACE is set but the header is }
  1155. { not found then if this flag is set, the header is added anyway, so long as }
  1156. { there is a valid header-value }
  1157.  
  1158.   HTTP_ADDREQ_FLAG_ADD            = $20000000; 
  1159.  
  1160. { HTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g. }
  1161. { "Accept: text/*" and "Accept: audio/*" with this flag results in a single }
  1162. { header: "Accept: text/*, audio/*" }
  1163.  
  1164.   HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA           = $40000000; 
  1165.   HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON       = $01000000; 
  1166.   HTTP_ADDREQ_FLAG_COALESCE                      = HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA; 
  1167.  
  1168. { HTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can }
  1169. { be supplied in the buffer. If the header to be replaced is not the first }
  1170. { in a list of headers with the same name, then the relative index should be }
  1171. { supplied in the low 8 bits of the dwModifiers parameter. If the header-value }
  1172. { part is missing, then the header is removed }
  1173.  
  1174.   HTTP_ADDREQ_FLAG_REPLACE        = $80000000; 
  1175.  
  1176.   
  1177. function HttpSendRequestA(hRequest: HINTERNET; lpszHeaders: PAnsiChar; 
  1178.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1179.   dwOptionalLength: DWORD): BOOL; stdcall;
  1180. function HttpSendRequestW(hRequest: HINTERNET; lpszHeaders: PWideChar; 
  1181.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1182.   dwOptionalLength: DWORD): BOOL; stdcall;
  1183. function HttpSendRequest(hRequest: HINTERNET; lpszHeaders: PChar; 
  1184.   dwHeadersLength: DWORD; lpOptional: Pointer; 
  1185.   dwOptionalLength: DWORD): BOOL; stdcall;
  1186.  
  1187. function HttpQueryInfoA(hRequest: HINTERNET; dwInfoLevel: DWORD; 
  1188.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD; 
  1189.   var lpdwReserved: DWORD): BOOL; stdcall;
  1190. function HttpQueryInfoW(hRequest: HINTERNET; dwInfoLevel: DWORD; 
  1191.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD; 
  1192.   var lpdwReserved: DWORD): BOOL; stdcall;
  1193. function HttpQueryInfo(hRequest: HINTERNET; dwInfoLevel: DWORD; 
  1194.   lpvBuffer: Pointer; var lpdwBufferLength: DWORD; 
  1195.   var lpdwReserved: DWORD): BOOL; stdcall;
  1196.  
  1197. { Cookie APIs }
  1198.  
  1199. function InternetSetCookieA(lpszUrl, lpszCookieName,
  1200.   lpszCookieData: PAnsiChar): BOOL; stdcall;
  1201. function InternetSetCookieW(lpszUrl, lpszCookieName,
  1202.   lpszCookieData: PWideChar): BOOL; stdcall;
  1203. function InternetSetCookie(lpszUrl, lpszCookieName,
  1204.   lpszCookieData: PChar): BOOL; stdcall;
  1205.  
  1206. function InternetGetCookieA(lpszUrl, lpszCookieName,
  1207.   lpszCookieData: PAnsiChar; var lpdwSize: DWORD): BOOL; stdcall;
  1208. function InternetGetCookieW(lpszUrl, lpszCookieName,
  1209.   lpszCookieData: PWideChar; var lpdwSize: DWORD): BOOL; stdcall;
  1210. function InternetGetCookie(lpszUrl, lpszCookieName,
  1211.   lpszCookieData: PChar; var lpdwSize: DWORD): BOOL; stdcall;
  1212.  
  1213.  
  1214. { Internet UI }
  1215.  
  1216. { InternetErrorDlg - Provides UI for certain Errors. }
  1217. const
  1218.   FLAGS_ERROR_UI_FILTER_FOR_ERRORS            = $01; 
  1219.   FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS         = $02; 
  1220.   FLAGS_ERROR_UI_FLAGS_GENERATE_DATA          = $04; 
  1221.   FLAGS_ERROR_UI_FLAGS_NO_UI                  = $08; 
  1222.  
  1223. function InternetErrorDlg(hWnd: HWND; hRequest: HINTERNET; 
  1224.   dwError, dwFlags: DWORD; var lppvData: Pointer): DWORD; stdcall;
  1225.  
  1226. function InternetConfirmZoneCrossing(hWnd: HWND;  
  1227.   szUrlPrev, szUrlNew: LPSTR; bPost: BOOL): DWORD; stdcall;
  1228.  
  1229.  
  1230. const
  1231.  
  1232. { Internet API error returns }
  1233.  
  1234.   INTERNET_ERROR_BASE                         = 12000; 
  1235.  
  1236.   ERROR_INTERNET_OUT_OF_HANDLES               = INTERNET_ERROR_BASE + 1; 
  1237.   ERROR_INTERNET_TIMEOUT                      = INTERNET_ERROR_BASE + 2; 
  1238.   ERROR_INTERNET_EXTENDED_ERROR               = INTERNET_ERROR_BASE + 3; 
  1239.   ERROR_INTERNET_INTERNAL_ERROR               = INTERNET_ERROR_BASE + 4; 
  1240.   ERROR_INTERNET_INVALID_URL                  = INTERNET_ERROR_BASE + 5; 
  1241.   ERROR_INTERNET_UNRECOGNIZED_SCHEME          = INTERNET_ERROR_BASE + 6; 
  1242.   ERROR_INTERNET_NAME_NOT_RESOLVED            = INTERNET_ERROR_BASE + 7; 
  1243.   ERROR_INTERNET_PROTOCOL_NOT_FOUND           = INTERNET_ERROR_BASE + 8; 
  1244.   ERROR_INTERNET_INVALID_OPTION               = INTERNET_ERROR_BASE + 9; 
  1245.   ERROR_INTERNET_BAD_OPTION_LENGTH            = INTERNET_ERROR_BASE + 10; 
  1246.   ERROR_INTERNET_OPTION_NOT_SETTABLE          = INTERNET_ERROR_BASE + 11; 
  1247.   ERROR_INTERNET_SHUTDOWN                     = INTERNET_ERROR_BASE + 12; 
  1248.   ERROR_INTERNET_INCORRECT_USER_NAME          = INTERNET_ERROR_BASE + 13; 
  1249.   ERROR_INTERNET_INCORRECT_PASSWORD           = INTERNET_ERROR_BASE + 14; 
  1250.   ERROR_INTERNET_LOGIN_FAILURE                = INTERNET_ERROR_BASE + 15; 
  1251.   ERROR_INTERNET_INVALID_OPERATION            = INTERNET_ERROR_BASE + 16; 
  1252.   ERROR_INTERNET_OPERATION_CANCELLED          = INTERNET_ERROR_BASE + 17; 
  1253.   ERROR_INTERNET_INCORRECT_HANDLE_TYPE        = INTERNET_ERROR_BASE + 18; 
  1254.   ERROR_INTERNET_INCORRECT_HANDLE_STATE       = INTERNET_ERROR_BASE + 19; 
  1255.   ERROR_INTERNET_NOT_PROXY_REQUEST            = INTERNET_ERROR_BASE + 20; 
  1256.   ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND     = INTERNET_ERROR_BASE + 21; 
  1257.   ERROR_INTERNET_BAD_REGISTRY_PARAMETER       = INTERNET_ERROR_BASE + 22; 
  1258.   ERROR_INTERNET_NO_DIRECT_ACCESS             = INTERNET_ERROR_BASE + 23; 
  1259.   ERROR_INTERNET_NO_CONTEXT                   = INTERNET_ERROR_BASE + 24; 
  1260.   ERROR_INTERNET_NO_CALLBACK                  = INTERNET_ERROR_BASE + 25; 
  1261.   ERROR_INTERNET_REQUEST_PENDING              = INTERNET_ERROR_BASE + 26; 
  1262.   ERROR_INTERNET_INCORRECT_FORMAT             = INTERNET_ERROR_BASE + 27; 
  1263.   ERROR_INTERNET_ITEM_NOT_FOUND               = INTERNET_ERROR_BASE + 28; 
  1264.   ERROR_INTERNET_CANNOT_CONNECT               = INTERNET_ERROR_BASE + 29; 
  1265.   ERROR_INTERNET_CONNECTION_ABORTED           = INTERNET_ERROR_BASE + 30; 
  1266.   ERROR_INTERNET_CONNECTION_RESET             = INTERNET_ERROR_BASE + 31; 
  1267.   ERROR_INTERNET_FORCE_RETRY                  = INTERNET_ERROR_BASE + 32; 
  1268.   ERROR_INTERNET_INVALID_PROXY_REQUEST        = INTERNET_ERROR_BASE + 33; 
  1269.  
  1270.   ERROR_INTERNET_HANDLE_EXISTS                = INTERNET_ERROR_BASE + 36; 
  1271.   ERROR_INTERNET_SEC_CERT_DATE_INVALID        = INTERNET_ERROR_BASE + 37; 
  1272.   ERROR_INTERNET_SEC_CERT_CN_INVALID          = INTERNET_ERROR_BASE + 38; 
  1273.   ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR       = INTERNET_ERROR_BASE + 39; 
  1274.   ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR       = INTERNET_ERROR_BASE + 40; 
  1275.   ERROR_INTERNET_MIXED_SECURITY               = INTERNET_ERROR_BASE + 41; 
  1276.   ERROR_INTERNET_CHG_POST_IS_NON_SECURE       = INTERNET_ERROR_BASE + 42; 
  1277.   ERROR_INTERNET_POST_IS_NON_SECURE           = INTERNET_ERROR_BASE + 43; 
  1278.  
  1279. { FTP API errors }
  1280.  
  1281.   ERROR_FTP_TRANSFER_IN_PROGRESS              = INTERNET_ERROR_BASE + 110; 
  1282.   ERROR_FTP_DROPPED                           = INTERNET_ERROR_BASE + 111; 
  1283.  
  1284.  
  1285. { gopher API errors }
  1286.  
  1287.   ERROR_GOPHER_PROTOCOL_ERROR                 = INTERNET_ERROR_BASE + 130; 
  1288.   ERROR_GOPHER_NOT_FILE                       = INTERNET_ERROR_BASE + 131; 
  1289.   ERROR_GOPHER_DATA_ERROR                     = INTERNET_ERROR_BASE + 132; 
  1290.   ERROR_GOPHER_END_OF_DATA                    = INTERNET_ERROR_BASE + 133; 
  1291.   ERROR_GOPHER_INVALID_LOCATOR                = INTERNET_ERROR_BASE + 134; 
  1292.   ERROR_GOPHER_INCORRECT_LOCATOR_TYPE         = INTERNET_ERROR_BASE + 135; 
  1293.   ERROR_GOPHER_NOT_GOPHER_PLUS                = INTERNET_ERROR_BASE + 136; 
  1294.   ERROR_GOPHER_ATTRIBUTE_NOT_FOUND            = INTERNET_ERROR_BASE + 137; 
  1295.   ERROR_GOPHER_UNKNOWN_LOCATOR                = INTERNET_ERROR_BASE + 138; 
  1296.  
  1297. { HTTP API errors }
  1298.  
  1299.   ERROR_HTTP_HEADER_NOT_FOUND                 = INTERNET_ERROR_BASE + 150; 
  1300.   ERROR_HTTP_DOWNLEVEL_SERVER                 = INTERNET_ERROR_BASE + 151; 
  1301.   ERROR_HTTP_INVALID_SERVER_RESPONSE          = INTERNET_ERROR_BASE + 152; 
  1302.   ERROR_HTTP_INVALID_HEADER                   = INTERNET_ERROR_BASE + 153; 
  1303.   ERROR_HTTP_INVALID_QUERY_REQUEST            = INTERNET_ERROR_BASE + 154; 
  1304.   ERROR_HTTP_HEADER_ALREADY_EXISTS            = INTERNET_ERROR_BASE + 155; 
  1305.   ERROR_HTTP_REDIRECT_FAILED                  = INTERNET_ERROR_BASE + 156; 
  1306.  
  1307.   INTERNET_ERROR_LAST                         = ERROR_HTTP_REDIRECT_FAILED; 
  1308.  
  1309.  
  1310. { URLCACHE APIs }
  1311.  
  1312. { datatype definitions. }
  1313.  
  1314. { cache entry type flags. }
  1315.  
  1316.   NORMAL_CACHE_ENTRY          = $00000001; 
  1317.   STABLE_CACHE_ENTRY          = $00000002; 
  1318.   STICKY_CACHE_ENTRY          = $00000004; 
  1319.  
  1320.   SPARSE_CACHE_ENTRY          = $00010000; 
  1321.   OCX_CACHE_ENTRY             = $00020000; 
  1322.  
  1323.  
  1324. type
  1325.   PInternetCacheEntryInfoA = ^TInternetCacheEntryInfoA;
  1326.   PInternetCacheEntryInfoW = ^TInternetCacheEntryInfoW;
  1327.   PInternetCacheEntryInfo = PInternetCacheEntryInfoA;
  1328.   TInternetCacheEntryInfoA = packed record 
  1329.     dwStructSize: DWORD;         { version of cache system. ?? do we need this for all entries? }
  1330.     lpszSourceUrlName: PAnsiChar;    { embedded pointer to the URL name string. }
  1331.     lpszLocalFileName: PAnsiChar;   { embedded pointer to the local file name. }
  1332.     CacheEntryType: DWORD;       { cache type bit mask. }
  1333.     dwUseCount: DWORD;           { current users count of the cache entry. }
  1334.     dwHitRate: DWORD;            { num of times the cache entry was retrieved. }
  1335.     dwSizeLow: DWORD;            { low DWORD of the file size. }
  1336.     dwSizeHigh: DWORD;           { high DWORD of the file size. }
  1337.     LastModifiedTime: TFileTime; { last modified time of the file in GMT format. }
  1338.     ExpireTime: TFileTime;       { expire time of the file in GMT format }
  1339.     LastAccessTime: TFileTime;   { last accessed time in GMT format }
  1340.     LastSyncTime: TFileTime;     { last time the URL was synchronized }
  1341.                                  { with the source }
  1342.     lpHeaderInfo: PBYTE;         { embedded pointer to the header info. }
  1343.     dwHeaderInfoSize: DWORD;     { size of the above header. }
  1344.     lpszFileExtension: PAnsiChar;   { File extension used to retrive the urldata as a file. }
  1345.     dwReserved: DWORD;           { reserved for future use. }
  1346.   end;
  1347.   TInternetCacheEntryInfoW = packed record 
  1348.     dwStructSize: DWORD;         { version of cache system. ?? do we need this for all entries? }
  1349.     lpszSourceUrlName: PAnsiChar;    { embedded pointer to the URL name string. }
  1350.     lpszLocalFileName: PWideChar;   { embedded pointer to the local file name. }
  1351.     CacheEntryType: DWORD;       { cache type bit mask. }
  1352.     dwUseCount: DWORD;           { current users count of the cache entry. }
  1353.     dwHitRate: DWORD;            { num of times the cache entry was retrieved. }
  1354.     dwSizeLow: DWORD;            { low DWORD of the file size. }
  1355.     dwSizeHigh: DWORD;           { high DWORD of the file size. }
  1356.     LastModifiedTime: TFileTime; { last modified time of the file in GMT format. }
  1357.     ExpireTime: TFileTime;       { expire time of the file in GMT format }
  1358.     LastAccessTime: TFileTime;   { last accessed time in GMT format }
  1359.     LastSyncTime: TFileTime;     { last time the URL was synchronized }
  1360.                                  { with the source }
  1361.     lpHeaderInfo: PBYTE;         { embedded pointer to the header info. }
  1362.     dwHeaderInfoSize: DWORD;     { size of the above header. }
  1363.     lpszFileExtension: PWideChar;   { File extension used to retrive the urldata as a file. }
  1364.     dwReserved: DWORD;           { reserved for future use. }
  1365.   end;
  1366.   TInternetCacheEntryInfo = TInternetCacheEntryInfoA;
  1367.  
  1368. { Cache APIs }
  1369.  
  1370. function CreateUrlCacheEntryA(lpszUrlName: PAnsiChar; 
  1371.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar; 
  1372.   lpszFileName: PAnsiChar; dwReserved: DWORD): BOOL; stdcall;
  1373. function CreateUrlCacheEntryW(lpszUrlName: PAnsiChar; 
  1374.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar; 
  1375.   lpszFileName: PWideChar; dwReserved: DWORD): BOOL; stdcall;
  1376. function CreateUrlCacheEntry(lpszUrlName: PAnsiChar; 
  1377.   dwExpectedFileSize: DWORD; lpszFileExtension: PAnsiChar; 
  1378.   lpszFileName: PChar; dwReserved: DWORD): BOOL; stdcall;
  1379.  
  1380. function CommitUrlCacheEntryA( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1381.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD; 
  1382.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PAnsiChar; 
  1383.   dwReserved: DWORD): BOOL; stdcall;
  1384. function CommitUrlCacheEntryW( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1385.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD; 
  1386.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PWideChar; 
  1387.   dwReserved: DWORD): BOOL; stdcall;
  1388. function CommitUrlCacheEntry( lpszUrlName, lpszLocalFileName: PAnsiChar;
  1389.   ExpireTime, LastModifiedTime: TFileTime;  CacheEntryType: DWORD; 
  1390.   lpHeaderInfo: PBYTE; dwHeaderSize: DWORD; lpszFileExtension: PChar; 
  1391.   dwReserved: DWORD): BOOL; stdcall;
  1392.  
  1393. function RetrieveUrlCacheEntryFileA(lpszUrlName: PAnsiChar; 
  1394.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1395.   var lpdwCacheEntryInfoBufferSize: DWORD; 
  1396.   dwReserved: DWORD): BOOL; stdcall;
  1397. function RetrieveUrlCacheEntryFileW(lpszUrlName: PAnsiChar; 
  1398.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1399.   var lpdwCacheEntryInfoBufferSize: DWORD; 
  1400.   dwReserved: DWORD): BOOL; stdcall;
  1401. function RetrieveUrlCacheEntryFile(lpszUrlName: PAnsiChar; 
  1402.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1403.   var lpdwCacheEntryInfoBufferSize: DWORD; 
  1404.   dwReserved: DWORD): BOOL; stdcall;
  1405.  
  1406. function UnlockUrlCacheEntryFile(lpszUrlName: LPCSTR; 
  1407.   dwReserved: DWORD): BOOL; stdcall;
  1408.  
  1409. function RetrieveUrlCacheEntryStreamA(lpszUrlName: PAnsiChar; 
  1410.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1411.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL; 
  1412.   dwReserved: DWORD): BOOL; stdcall;
  1413. function RetrieveUrlCacheEntryStreamW(lpszUrlName: PAnsiChar; 
  1414.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1415.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL; 
  1416.   dwReserved: DWORD): BOOL; stdcall;
  1417. function RetrieveUrlCacheEntryStream(lpszUrlName: PAnsiChar; 
  1418.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1419.   var lpdwCacheEntryInfoBufferSize: DWORD; fRandomRead: BOOL; 
  1420.   dwReserved: DWORD): BOOL; stdcall;
  1421.  
  1422. function ReadUrlCacheEntryStream(hUrlCacheStream: THandle; 
  1423.   dwLocation: DWORD; var lpBuffer: Pointer; 
  1424.   var lpdwLen: DWORD; Reserved: DWORD): BOOL; stdcall;
  1425.  
  1426. function UnlockUrlCacheEntryStream(hUrlCacheStream: THandle; 
  1427.   Reserved: DWORD): BOOL; stdcall;
  1428.  
  1429. function GetUrlCacheEntryInfoA(lpszUrlName: PAnsiChar; 
  1430.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1431.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1432. function GetUrlCacheEntryInfoW(lpszUrlName: PAnsiChar; 
  1433.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1434.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1435. function GetUrlCacheEntryInfo(lpszUrlName: PAnsiChar; 
  1436.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1437.   var lpdwCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1438.  
  1439. const
  1440.   CACHE_ENTRY_ATTRIBUTE_FC        = $00000004; 
  1441.   CACHE_ENTRY_HITRATE_FC          = $00000010; 
  1442.   CACHE_ENTRY_MODTIME_FC          = $00000040; 
  1443.   CACHE_ENTRY_EXPTIME_FC          = $00000080; 
  1444.   CACHE_ENTRY_ACCTIME_FC          = $00000100; 
  1445.   CACHE_ENTRY_SYNCTIME_FC         = $00000200; 
  1446.   CACHE_ENTRY_HEADERINFO_FC       = $00000400; 
  1447.  
  1448. function SetUrlCacheEntryInfoA(lpszUrlName: PAnsiChar; 
  1449.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1450.   dwFieldControl: DWORD): BOOL; stdcall;
  1451. function SetUrlCacheEntryInfoW(lpszUrlName: PAnsiChar; 
  1452.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1453.   dwFieldControl: DWORD): BOOL; stdcall;
  1454. function SetUrlCacheEntryInfo(lpszUrlName: PAnsiChar; 
  1455.   var lpCacheEntryInfo: TInternetCacheEntryInfo; 
  1456.   dwFieldControl: DWORD): BOOL; stdcall;
  1457.  
  1458. function FindFirstUrlCacheEntryA(lpszUrlSearchPattern: PAnsiChar; 
  1459.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo; 
  1460.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1461. function FindFirstUrlCacheEntryW(lpszUrlSearchPattern: PAnsiChar; 
  1462.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo; 
  1463.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1464. function FindFirstUrlCacheEntry(lpszUrlSearchPattern: PAnsiChar; 
  1465.   var lpFirstCacheEntryInfo: TInternetCacheEntryInfo; 
  1466.   var lpdwFirstCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1467.  
  1468. function FindNextUrlCacheEntryA(hEnumHandle: THandle; 
  1469.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo; 
  1470.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1471. function FindNextUrlCacheEntryW(hEnumHandle: THandle; 
  1472.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo; 
  1473.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1474. function FindNextUrlCacheEntry(hEnumHandle: THandle; 
  1475.   var lpNextCacheEntryInfo: TInternetCacheEntryInfo; 
  1476.   var lpdwNextCacheEntryInfoBufferSize: DWORD): BOOL; stdcall;
  1477.  
  1478. function FindCloseUrlCache(hEnumHandle: THandle): BOOL; stdcall;
  1479.  
  1480. function DeleteUrlCacheEntry(lpszUrlName: LPCSTR): BOOL; stdcall;
  1481.  
  1482. implementation
  1483.  
  1484. const
  1485.   winetdll = 'wininet.dll';
  1486.  
  1487. function CommitUrlCacheEntryA;          external winetdll name 'CommitUrlCacheEntryA';
  1488. function CommitUrlCacheEntryW;          external winetdll name 'CommitUrlCacheEntryW';
  1489. function CommitUrlCacheEntry;          external winetdll name 'CommitUrlCacheEntryA';
  1490. function CreateUrlCacheEntryA;          external winetdll name 'CreateUrlCacheEntryA';
  1491. function CreateUrlCacheEntryW;          external winetdll name 'CreateUrlCacheEntryW';
  1492. function CreateUrlCacheEntry;          external winetdll name 'CreateUrlCacheEntryA';
  1493. function DeleteUrlCacheEntry;             external winetdll name 'DeleteUrlCacheEntry';
  1494. function FindCloseUrlCache;               external winetdll name 'FindCloseUrlCache';
  1495. function FindFirstUrlCacheEntryA;       external winetdll name 'FindFirstUrlCacheEntryA';
  1496. function FindFirstUrlCacheEntryW;       external winetdll name 'FindFirstUrlCacheEntryW';
  1497. function FindFirstUrlCacheEntry;       external winetdll name 'FindFirstUrlCacheEntryA';
  1498. function FindNextUrlCacheEntryA;        external winetdll name 'FindNextUrlCacheEntryA';
  1499. function FindNextUrlCacheEntryW;        external winetdll name 'FindNextUrlCacheEntryW';
  1500. function FindNextUrlCacheEntry;        external winetdll name 'FindNextUrlCacheEntryA';
  1501. function FtpCommandA;                   external winetdll name 'FtpCommandA';
  1502. function FtpCommandW;                   external winetdll name 'FtpCommandW';
  1503. function FtpCommand;                   external winetdll name 'FtpCommandA';
  1504. function FtpCreateDirectoryA;           external winetdll name 'FtpCreateDirectoryA';
  1505. function FtpCreateDirectoryW;           external winetdll name 'FtpCreateDirectoryW';
  1506. function FtpCreateDirectory;           external winetdll name 'FtpCreateDirectoryA';
  1507. function FtpDeleteFileA;                external winetdll name 'FtpDeleteFileA';
  1508. function FtpDeleteFileW;                external winetdll name 'FtpDeleteFileW';
  1509. function FtpDeleteFile;                external winetdll name 'FtpDeleteFileA';
  1510. function FtpFindFirstFileA;             external winetdll name 'FtpFindFirstFileA';
  1511. function FtpFindFirstFileW;             external winetdll name 'FtpFindFirstFileW';
  1512. function FtpFindFirstFile;             external winetdll name 'FtpFindFirstFileA';
  1513. function FtpGetCurrentDirectoryA;       external winetdll name 'FtpGetCurrentDirectoryA';
  1514. function FtpGetCurrentDirectoryW;       external winetdll name 'FtpGetCurrentDirectoryW';
  1515. function FtpGetCurrentDirectory;       external winetdll name 'FtpGetCurrentDirectoryA';
  1516. function FtpGetFileA;                   external winetdll name 'FtpGetFileA';
  1517. function FtpGetFileW;                   external winetdll name 'FtpGetFileW';
  1518. function FtpGetFile;                   external winetdll name 'FtpGetFileA';
  1519. function FtpOpenFileA;                  external winetdll name 'FtpOpenFileA';
  1520. function FtpOpenFileW;                  external winetdll name 'FtpOpenFileW';
  1521. function FtpOpenFile;                  external winetdll name 'FtpOpenFileA';
  1522. function FtpPutFileA;                   external winetdll name 'FtpPutFileA';
  1523. function FtpPutFileW;                   external winetdll name 'FtpPutFileW';
  1524. function FtpPutFile;                   external winetdll name 'FtpPutFileA';
  1525. function FtpRemoveDirectoryA;           external winetdll name 'FtpRemoveDirectoryA';
  1526. function FtpRemoveDirectoryW;           external winetdll name 'FtpRemoveDirectoryW';
  1527. function FtpRemoveDirectory;           external winetdll name 'FtpRemoveDirectoryA';
  1528. function FtpRenameFileA;                external winetdll name 'FtpRenameFileA';
  1529. function FtpRenameFileW;                external winetdll name 'FtpRenameFileW';
  1530. function FtpRenameFile;                external winetdll name 'FtpRenameFileA';
  1531. function FtpSetCurrentDirectoryA;       external winetdll name 'FtpSetCurrentDirectoryA';
  1532. function FtpSetCurrentDirectoryW;       external winetdll name 'FtpSetCurrentDirectoryW';
  1533. function FtpSetCurrentDirectory;       external winetdll name 'FtpSetCurrentDirectoryA';
  1534. function GetUrlCacheEntryInfoA;         external winetdll name 'GetUrlCacheEntryInfoA';
  1535. function GetUrlCacheEntryInfoW;         external winetdll name 'GetUrlCacheEntryInfoW';
  1536. function GetUrlCacheEntryInfo;         external winetdll name 'GetUrlCacheEntryInfoA';
  1537. function GopherCreateLocatorA;          external winetdll name 'GopherCreateLocatorA';
  1538. function GopherCreateLocatorW;          external winetdll name 'GopherCreateLocatorW';
  1539. function GopherCreateLocator;          external winetdll name 'GopherCreateLocatorA';
  1540. function GopherFindFirstFileA;          external winetdll name 'GopherFindFirstFileA';
  1541. function GopherFindFirstFileW;          external winetdll name 'GopherFindFirstFileW';
  1542. function GopherFindFirstFile;          external winetdll name 'GopherFindFirstFileA';
  1543. function GopherGetAttributeA;           external winetdll name 'GopherGetAttributeA';
  1544. function GopherGetAttributeW;           external winetdll name 'GopherGetAttributeW';
  1545. function GopherGetAttribute;           external winetdll name 'GopherGetAttributeA';
  1546. function GopherGetLocatorTypeA;         external winetdll name 'GopherGetLocatorTypeA';
  1547. function GopherGetLocatorTypeW;         external winetdll name 'GopherGetLocatorTypeW';
  1548. function GopherGetLocatorType;         external winetdll name 'GopherGetLocatorTypeA';
  1549. function GopherOpenFileA;               external winetdll name 'GopherOpenFileA';
  1550. function GopherOpenFileW;               external winetdll name 'GopherOpenFileW';
  1551. function GopherOpenFile;               external winetdll name 'GopherOpenFileA';
  1552. function HttpAddRequestHeadersA;        external winetdll name 'HttpAddRequestHeadersA';
  1553. function HttpAddRequestHeadersW;        external winetdll name 'HttpAddRequestHeadersW';
  1554. function HttpAddRequestHeaders;        external winetdll name 'HttpAddRequestHeadersA';
  1555. function HttpOpenRequestA;              external winetdll name 'HttpOpenRequestA';
  1556. function HttpOpenRequestW;              external winetdll name 'HttpOpenRequestW';
  1557. function HttpOpenRequest;              external winetdll name 'HttpOpenRequestA';
  1558. function HttpQueryInfoA;                external winetdll name 'HttpQueryInfoA';
  1559. function HttpQueryInfoW;                external winetdll name 'HttpQueryInfoW';
  1560. function HttpQueryInfo;                external winetdll name 'HttpQueryInfoA';
  1561. function HttpSendRequestA;              external winetdll name 'HttpSendRequestA';
  1562. function HttpSendRequestW;              external winetdll name 'HttpSendRequestW';
  1563. function HttpSendRequest;              external winetdll name 'HttpSendRequestA';
  1564. function InternetCanonicalizeUrlA;      external winetdll name 'InternetCanonicalizeUrlA';
  1565. function InternetCanonicalizeUrlW;      external winetdll name 'InternetCanonicalizeUrlW';
  1566. function InternetCanonicalizeUrl;      external winetdll name 'InternetCanonicalizeUrlA';
  1567. function InternetCloseHandle;             external winetdll name 'InternetCloseHandle';
  1568. function InternetCombineUrlA;           external winetdll name 'InternetCombineUrlA';
  1569. function InternetCombineUrlW;           external winetdll name 'InternetCombineUrlW';
  1570. function InternetCombineUrl;           external winetdll name 'InternetCombineUrlA';
  1571. function InternetConfirmZoneCrossing;     external winetdll name 'InternetConfirmZoneCrossing';
  1572. function InternetConnectA;              external winetdll name 'InternetConnectA';
  1573. function InternetConnectW;              external winetdll name 'InternetConnectW';
  1574. function InternetConnect;              external winetdll name 'InternetConnectA';
  1575. function InternetCrackUrlA;             external winetdll name 'InternetCrackUrlA';
  1576. function InternetCrackUrlW;             external winetdll name 'InternetCrackUrlW';
  1577. function InternetCrackUrl;             external winetdll name 'InternetCrackUrlA';
  1578. function InternetCreateUrlA;            external winetdll name 'InternetCreateUrlA';
  1579. function InternetCreateUrlW;            external winetdll name 'InternetCreateUrlW';
  1580. function InternetCreateUrl;            external winetdll name 'InternetCreateUrlA';
  1581. function InternetErrorDlg;                external winetdll name 'InternetErrorDlg';
  1582. function InternetFindNextFileA;         external winetdll name 'InternetFindNextFileA';
  1583. function InternetFindNextFileW;         external winetdll name 'InternetFindNextFileW';
  1584. function InternetFindNextFile;         external winetdll name 'InternetFindNextFileA';
  1585. function InternetGetCookieA;            external winetdll name 'InternetGetCookieA';
  1586. function InternetGetCookieW;            external winetdll name 'InternetGetCookieW';
  1587. function InternetGetCookie;            external winetdll name 'InternetGetCookieA';
  1588. function InternetGetLastResponseInfoA;  external winetdll name 'InternetGetLastResponseInfoA';
  1589. function InternetGetLastResponseInfoW;  external winetdll name 'InternetGetLastResponseInfoW';
  1590. function InternetGetLastResponseInfo;  external winetdll name 'InternetGetLastResponseInfoA';
  1591. function InternetOpenA;                 external winetdll name 'InternetOpenA';
  1592. function InternetOpenW;                 external winetdll name 'InternetOpenW';
  1593. function InternetOpen;                 external winetdll name 'InternetOpenA';
  1594. function InternetOpenUrlA;              external winetdll name 'InternetOpenUrlA';
  1595. function InternetOpenUrlW;              external winetdll name 'InternetOpenUrlW';
  1596. function InternetOpenUrl;              external winetdll name 'InternetOpenUrlA';
  1597. function InternetQueryDataAvailable;      external winetdll name 'InternetQueryDataAvailable';
  1598. function InternetQueryOptionA;          external winetdll name 'InternetQueryOptionA';
  1599. function InternetQueryOptionW;          external winetdll name 'InternetQueryOptionW';
  1600. function InternetQueryOption;          external winetdll name 'InternetQueryOptionA';
  1601. function InternetReadFile;                external winetdll name 'InternetReadFile';
  1602. function InternetSetCookieA;            external winetdll name 'InternetSetCookieA';
  1603. function InternetSetCookieW;            external winetdll name 'InternetSetCookieW';
  1604. function InternetSetCookie;            external winetdll name 'InternetSetCookieA';
  1605. function InternetSetFilePointer;          external winetdll name 'InternetSetFilePointer';
  1606. function InternetSetOptionA;            external winetdll name 'InternetSetOptionA';
  1607. function InternetSetOptionW;            external winetdll name 'InternetSetOptionW';
  1608. function InternetSetOption;            external winetdll name 'InternetSetOptionA';
  1609. function InternetSetOptionExA;          external winetdll name 'InternetSetOptionExA';
  1610. function InternetSetOptionExW;          external winetdll name 'InternetSetOptionExW';
  1611. function InternetSetOptionEx;          external winetdll name 'InternetSetOptionExA';
  1612. function InternetSetStatusCallback;       external winetdll name 'InternetSetStatusCallback';
  1613. function InternetTimeFromSystemTime;      external winetdll name 'InternetTimeFromSystemTime';
  1614. function InternetWriteFile;               external winetdll name 'InternetWriteFile';
  1615. function ReadUrlCacheEntryStream;         external winetdll name 'ReadUrlCacheEntryStream';
  1616. function RetrieveUrlCacheEntryFileA;    external winetdll name 'RetrieveUrlCacheEntryFileA';
  1617. function RetrieveUrlCacheEntryFileW;    external winetdll name 'RetrieveUrlCacheEntryFileW';
  1618. function RetrieveUrlCacheEntryFile;    external winetdll name 'RetrieveUrlCacheEntryFileA';
  1619. function RetrieveUrlCacheEntryStreamA;  external winetdll name 'RetrieveUrlCacheEntryStreamA';
  1620. function RetrieveUrlCacheEntryStreamW;  external winetdll name 'RetrieveUrlCacheEntryStreamW';
  1621. function RetrieveUrlCacheEntryStream;  external winetdll name 'RetrieveUrlCacheEntryStreamA';
  1622. function SetUrlCacheEntryInfoA;         external winetdll name 'SetUrlCacheEntryInfoA';
  1623. function SetUrlCacheEntryInfoW;         external winetdll name 'SetUrlCacheEntryInfoW';
  1624. function SetUrlCacheEntryInfo;         external winetdll name 'SetUrlCacheEntryInfoA';
  1625. function UnlockUrlCacheEntryFile;         external winetdll name 'UnlockUrlCacheEntryFile';
  1626. function UnlockUrlCacheEntryStream;       external winetdll name 'UnlockUrlCacheEntryStream';
  1627.  
  1628. function IS_GOPHER_FILE(GopherType: DWORD): BOOL;
  1629. begin
  1630.   Result := GopherType and GOPHER_TYPE_FILE_MASK = 0;
  1631. end;
  1632.  
  1633. function IS_GOPHER_DIRECTORY(GopherType: DWORD): BOOL;
  1634. begin
  1635.   Result := GopherType and GOPHER_TYPE_DIRECTORY = 0;
  1636. end;
  1637.  
  1638. function IS_GOPHER_PHONE_SERVER(GopherType: DWORD): BOOL;
  1639. begin
  1640.   Result := GopherType and GOPHER_TYPE_CSO = 0;
  1641. end;
  1642.  
  1643. function IS_GOPHER_ERROR(GopherType: DWORD): BOOL;
  1644. begin
  1645.   Result := GopherType and GOPHER_TYPE_ERROR = 0;
  1646. end;
  1647.  
  1648. function IS_GOPHER_INDEX_SERVER(GopherType: DWORD): BOOL;
  1649. begin
  1650.   Result := GopherType and GOPHER_TYPE_INDEX_SERVER = 0;
  1651. end;
  1652.  
  1653. function IS_GOPHER_TELNET_SESSION(GopherType: DWORD): BOOL;
  1654. begin
  1655.   Result := GopherType and GOPHER_TYPE_TELNET = 0;
  1656. end;
  1657.  
  1658. function IS_GOPHER_BACKUP_SERVER(GopherType: DWORD): BOOL;
  1659. begin
  1660.   Result := GopherType and GOPHER_TYPE_REDUNDANT = 0;
  1661. end;
  1662.  
  1663. function IS_GOPHER_TN3270_SESSION(GopherType: DWORD): BOOL;
  1664. begin
  1665.   Result := GopherType and GOPHER_TYPE_TN3270 = 0;
  1666. end;
  1667.  
  1668. function IS_GOPHER_ASK(GopherType: DWORD): BOOL;
  1669. begin
  1670.   Result := GopherType and GOPHER_TYPE_ASK = 0;
  1671. end;
  1672.  
  1673. function IS_GOPHER_PLUS(GopherType: DWORD): BOOL;
  1674. begin
  1675.   Result := GopherType and GOPHER_TYPE_GOPHER_PLUS = 0;
  1676. end;
  1677.  
  1678. function IS_GOPHER_TYPE_KNOWN(GopherType: DWORD): BOOL;
  1679. begin
  1680.   Result := GopherType and GOPHER_TYPE_UNKNOWN = 0;
  1681. end;
  1682.  
  1683. end.
  1684.